# \[BUG-12836\] com.google.gson.internal.LazilyParsedNumber Type

**URL:** <https://forum.inductiveautomation.com/t/bug-12836-com-google-gson-internal-lazilyparsednumber-type/21976>\
**Category:** Ignition Early Access\
**Created:** [January 18, 2019, 4:39pm UTC](https://forum.inductiveautomation.com/t/bug-12836-com-google-gson-internal-lazilyparsednumber-type/21976 "2019-01-18T16:39:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrea.morando](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrea.morando/32/8039_2.png) [@andrea.morando](https://forum.inductiveautomation.com/u/andrea.morando)\
**Post date:** [January 18, 2019, 4:39pm UTC](https://forum.inductiveautomation.com/t/bug-12836-com-google-gson-internal-lazilyparsednumber-type/21976/1 "2019-01-18T16:39:33Z")

</div>

Hi,  
I am currently using the beta **b2019011502**.  
On the “style classes” property of a Label component, I set an Expression Structure binding, as below.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/d/d0b6f283bea3c0f2a5519d043c650f360b537f83.png)

The key-values pairs are:

- the “allow” key has a constant custom property value.
- the two keys “actual” and “target” have two tags values.

The script throws an exception with the following message:  
\*_General Error: unsupported operand type(s) for : ‘float’ and 'com.google.gson.internal.LazilyParsedNumber_

What is going on? Thank you.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [January 28, 2019, 9:51pm UTC](https://forum.inductiveautomation.com/t/bug-12836-com-google-gson-internal-lazilyparsednumber-type/21976/2 "2019-01-28T21:51:33Z")

</div>

After replicating your script I’m not encountering the same issue…

**Next steps to help me troubleshoot:**

1. Are the self.view.custom.additionalInfo.thresholds.low/high properties bound to other values?
2. Where exactly are you seeing this error message? Designer console? Browser console? Gateway logs?

First note: It _looks_ like the script is attempting to operate on two different types of objects (a “float” and a “com.google.gson.internal.LazilyParsedNumber”). That com.google.gson.internal.LazilyParsedNumber should be digested into a usable value by the time it reaches you script.

Second note: “actual” and “target” are bound to properties, not tags. Even if the `view.custom.actual` and `view.custom.target` properties are bound to tags, I’m still not able to replicate the issue.

Third note: It’s very odd that there is no operand declared in the error message you’ve supplied - I would have expected \< or \>= or \*… Could you double-check the error message and make sure there isn’t a character omitted from what you’ve posted?

---

<div class="post-metadata">

**Author:** ![andrea.morando](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrea.morando/32/8039_2.png) [@andrea.morando](https://forum.inductiveautomation.com/u/andrea.morando)\
**Post date:** [February 18, 2019, 8:13am UTC](https://forum.inductiveautomation.com/t/bug-12836-com-google-gson-internal-lazilyparsednumber-type/21976/3 "2019-02-18T08:13:08Z")

</div>

_1. Are the self.view.custom.additionalInfo.thresholds.low/high properties bound to other values?_  
No, they are constant values.  
_2. Where exactly are you seeing this error message? Designer console? Browser console? Gateway logs?_  
In the gateway logs.

I could try t replicate this error with the latest nightly build.  
Thanks,  
Andrea

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 19, 2019, 3:05pm UTC](https://forum.inductiveautomation.com/t/bug-12836-com-google-gson-internal-lazilyparsednumber-type/21976/4 "2019-02-19T15:05:36Z")

</div>

While I don’t know that it’s necessary, you could also try wrapping your comparisons in parentheses to rule out a syntax error in the first elif:  
`a < b < c:` _should_ be okay, but `(a < b) and (b < c):` is definitely okay. A syntax error of this type could explain the “:” from your error message…

---

<div class="post-metadata">

**Author:** ![osolorzano](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/osolorzano/32/6432_2.png) [@osolorzano](https://forum.inductiveautomation.com/u/osolorzano)\
**Post date:** [February 20, 2019, 6:33pm UTC](https://forum.inductiveautomation.com/t/bug-12836-com-google-gson-internal-lazilyparsednumber-type/21976/5 "2019-02-20T18:33:31Z")

</div>

That error occurs because an operand used in a mathematical equation is of type lazilyparsednumber and not a normal numeric type. I can’t tell what line it is occurring from the error you provided and couldn’t reproduce on my machine. That said, judging by the fact that your binding preview is returning a value from inside the try block and not from the except block, how sure are you that the error is being caused by this script?

Regardless, there is an easy way to get the value you want out of a lazilyparsednumber which is sort of documented here: [https://github.com/google/gson/blob/master/gson/src/main/java/com/google/gson/internal/LazilyParsedNumber.java](https://github.com/google/gson/blob/master/gson/src/main/java/com/google/gson/internal/LazilyParsedNumber.java)

Basically, if you find out what variable is the lazilyparsednumber (lets say self.view.custom.additionalInfo.thresholds.low) and you want to get the float value out of it, you can use the floatValue() method like so: self.view.custom.additionalInfo.thresholds.low.floatValue()

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 20, 2019, 8:32pm UTC](https://forum.inductiveautomation.com/t/bug-12836-com-google-gson-internal-lazilyparsednumber-type/21976/6 "2019-02-20T20:32:31Z")

</div>

> [@osolorzano](#):
>
> Basically, if you find out what variable is the lazilyparsednumber (lets say self.view.custom.additionalInfo.thresholds.low) and you want to get the float value out of it, you can use the floatValue() method like so: self.view.custom.additionalInfo.thresholds.low.floatValue()

I don't think this should be something the user has to do. This is probably a bug.

---

<div class="post-metadata">

**Author:** ![awalker](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/awalker/32/6874_2.png) [@awalker](https://forum.inductiveautomation.com/u/awalker)\
**Post date:** [March 15, 2019, 3:16pm UTC](https://forum.inductiveautomation.com/t/bug-12836-com-google-gson-internal-lazilyparsednumber-type/21976/7 "2019-03-15T15:16:29Z")

</div>

This issue was fixed in the build that was uploaded today (3/15). Please let us know if you continue to see this behavior after upgrading.
