# Negative numbers lose sign in parsed json

**URL:** <https://forum.sensmetry.com/t/negative-numbers-lose-sign-in-parsed-json/273>\
**Category:** Bug Reports\
**Tags:** resolved, automator\
**Created:** [October 24, 2025, 12:00am UTC](https://forum.sensmetry.com/t/negative-numbers-lose-sign-in-parsed-json/273 "2025-10-24T00:00:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Karban](https://yyz2.discourse-cdn.com/flex008/user_avatar/forum.sensmetry.com/robert_karban/32/119_2.png) [@Robert\_Karban](https://forum.sensmetry.com/u/Robert_Karban)\
**Post date:** [October 24, 2025, 12:00am UTC](https://forum.sensmetry.com/t/negative-numbers-lose-sign-in-parsed-json/273/1 "2025-10-24T00:00:44Z")

</div>

Hi,

When parsing this model, the resulting json doesn’t preserve the negative sign:

```auto
package MyStructureC1 {
    private import ScalarValues::*;
    part def Component{
        attribute tx:Real;
        attribute ty:Real;
        attribute tz:Real;
        attribute rx:Real;
        attribute ry:Real;
        attribute rz:Real;
        attribute typeID:Integer;
        part children: Component[0..*];
    }

     part def Context {
        part myStructureC1 :Component {
            part nx0001g subsets children {
                attribute :>> tx=0.0;
                attribute :>> ty=0.0;
                attribute :>> tz=0.0;
                attribute :>> rx=0.0;
                attribute :>> ry=0.0;
                attribute :>> rz=0.0;
                attribute :>> typeID = 100;
                part pwr0001g subsets children {
                    attribute :>> tx=684.0;
                    attribute :>> ty=0.0;
                    attribute :>> tz=300.0;
                    attribute :>> rx=0.0;
                    attribute :>> ry=3.1412;
                    attribute :>> rz=0.0;
                    attribute :>> typeID = 0;
                }

                part pwr0002g subsets children {
                    attribute :>> tx=556.0;
                    attribute :>> ty= -410.0;
                    attribute :>> tz= -38.1;
                    attribute :>> rx=0.0;
                    attribute :>> ry=3.1412;
                    attribute :>> rz=0.0;
                    attribute :>> typeID = 1;
                }
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![Robert\_Karban](https://yyz2.discourse-cdn.com/flex008/user_avatar/forum.sensmetry.com/robert_karban/32/119_2.png) [@Robert\_Karban](https://forum.sensmetry.com/u/Robert_Karban)\
**Post date:** [October 24, 2025, 12:43am UTC](https://forum.sensmetry.com/t/negative-numbers-lose-sign-in-parsed-json/273/2 "2025-10-24T00:43:40Z")

</div>

Actually, we just solved it ourselves 🙂  
Turns out negative numbers are expressions and when parsing you need to:

```python
attr = e.cast(syside.AttributeUsage)
expression = next(iter(attr.owned_elements), None)
if expression is not None and isinstance(expression, syside.Expression):
                    compiler = syside.Compiler()
                    result, report = compiler.evaluate(expression)
                    print(result)

```
