Negative numbers lose sign in parsed json

Hi,

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

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;
                }
            }
        }
    }
}

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

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)