Issue with JSON parser and negative numbers

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

The JSON parser library does not seem to support negative "numbers", the "-" is cut of the object string before the user callback been

invoked.


This can be fixed by including the minus sign as part of the object strings, replacing the following tests in multiple places of the JSON parser lib

/* Move value_start token until we encounter a non-digit value */

-                        while ( ( ( *value_start >= '0' ) && (  *value_start <= '9') ) || ( *value_start == '.' ) )

by

                         while ( ( ( *value_start >= '0' ) && (  *value_start <= '9') ) || ( *value_start == '.' ) || ( *value_start == '-' )

1 Reply
VikramR_26
Employee
Employee
25 sign-ins 10 sign-ins 10 comments on KBA

Thanks for providing solution.

0 Likes