Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 19:14 Go to next message
Fabian Sow is currently offline Fabian SowFriend
Messages: 9
Registered: January 2022
Junior Member
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 08:24 Go to previous messageGo to next message
Adam Knapp is currently offline Adam KnappFriend
Messages: 54
Registered: November 2020
Member
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 08:41 Go to previous messageGo to next message
Adam Knapp is currently offline Adam KnappFriend
Messages: 54
Registered: November 2020
Member
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 06:33 Go to previous message
Fabian Sow is currently offline Fabian SowFriend
Messages: 9
Registered: January 2022
Junior Member
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: Fri Oct 11 15:51:15 GMT 2024

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

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

Back to the top