REST response for long datatype converting from String

1
I am getting a response from REST service which contains long datatype but Mendix is treating that at string and converting it to Long then which is throwing  NumberFormatException error .   Rest Service Respone :  {"date":"2017-05-08 00:00:00","quantity":-3900000,"item":"food","type":"Others"} Resposne in Mendix (via log level as Trace) {"date":"2017-05-08 00:00:00","quantity":-3900000.0,"item":"food","type":"Others"} datatype of quantity in import mapping and mendix entity is long and i don't know from where the decimal part is adding to it which is throwing the exception by considering the quantity value as string error in the logs is (JSON Import: java.lang.NumberFormatException: For input string: "-3900000.0")
asked
2 answers
2

Hi Rohit,
I am not sure where the ".0" is coming from. As a workaround you can try to catch the value as a Decimal in a separate attrbiute and then do a conversion to Long manually in a before commit microflow. Just an idea, I understand it doesn't really solve the original problem of why there is a decimal 0 added there in the first place.
-Andrej
 

answered
0

@Joost Verhoog 

The highlighted quantity attributes are coming with decimal part from Mendix. Using Postman the service is returning the long value only without decimal part. 

Attached JSON structure 

answered