JSON library based on JSMN lib

Dependents:   ATT_WNCInterface_Info WNCInterface_HTTP_example NerfUS-Coord Mbed_Prototype_copy_4_INNO_day_15_6_2017 ... more

Issue: correct format string is not valid json

hello!

according to your piece of code, my legitamately correct json string: '{"order":"RUN","speeds":[100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0],"listeners":[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]}' which consists of three pairs: - first is (string,string) - second is (string, array of int) - third is (string, array of int) doesn't pass the isValidJson() function...

please help!

here's a piece of code you can run to check it

<<code title= little test case>> const char* message = "{\"order\":\"RUN\",\"speeds\":[100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0],\"listeners\":[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]}"; Json myd(message, strlen(message)); if ( !myd.isValidJson () ) { printf( "Invalid JSON: %s\n", message );

return -1; } <<\code>>

1 comment:

20 Dec 2019

Issue was solved adding Quotation mark before and after the array definition.