Skip to main content



      Home
Home » Eclipse Projects » Eclipse Titan » JSON decode error - float values(JSON decoding errors for certain float values)
JSON decode error - float values [message #1853290] Sun, 26 June 2022 15:14 Go to next message
Eclipse UserFriend
Hello,

I am receiving a JSON message from a component, which I decode with the internal JSON decoder.

From time to time I get decoding errors from the internal JSON decoder.
While JSON-decoding type ...: Failed to extract valid token, invalid JSON format
Can not decode type ..., because invalid or incomplete message was received


It seems that it is related to float values in certain ranges. I typically receive rather small values in exponential format, e.g. 2.7e-9.

I can reproduce this behavior in the attached minimal example where different JSON messages with float values are sent, where some can be decoded and others not.

Is there an explanation for this behavior?

Best regards,
Fabian



Re: JSON decode error - float values [message #1853335 is a reply to message #1853290] Tue, 28 June 2022 04:24 Go to previous messageGo to next message
Eclipse UserFriend
Hi Fabian,

Thank you for bringing this up! It really seems to be a bug. I created an issue to follow up: https://gitlab.eclipse.org/eclipse/titan/titan.core/-/issues/609
Re: JSON decode error - float values [message #1853420 is a reply to message #1853335] Fri, 01 July 2022 04:41 Go to previous messageGo to next message
Eclipse UserFriend
Hi Fabian,

The fix was merged, i.e. you should not get the error message above, instead the JSON float value should be decoded correctly.
Please note that that the accuracy of encoded float numbers is limited to 6 decimal places in Titan currently meaning that e.g. 1.2345678 will be encoded as 1.234567, as well as 1.2345678e-9 will be 1.234567e-09.
We are working on the improvement.
Re: JSON decode error - float values [message #1853448 is a reply to message #1853420] Sat, 02 July 2022 02:33 Go to previous message
Eclipse UserFriend
Hi Adam,

thanks for the quick fix and the clarification regarding the accuracy!
It works for me.
Previous Topic:usage of LENGTHTO and UNIT(elements)
Next Topic:the cfg of tft in 3gpp
Goto Forum:
  


Current Time: Mon Mar 10 20:49:17 EDT 2025

Powered by FUDForum. Page generated in 0.04499 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top