You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JSON String = { "run_time":"10:00", "ps2":0, "ps3":0}} //Extra "}" curly brace at the end.
I have a JSON string something like above with two curly braces }} at the end. This is invalid json string. But I don't see any error when json_tokener_parse or json_tokener_parse_ex is called with correct str and stringlen parameters and JSON_TOKENER_STRICT flag is set. Please help!
When I check "jerr" it does not through any error. How to validate the json string using json-c ?
JSON String = { "run_time":"10:00", "ps2":0, "ps3":0}} //Extra "}" curly brace at the end.
I have a JSON string something like above with two curly braces }} at the end. This is invalid json string. But I don't see any error when json_tokener_parse or json_tokener_parse_ex is called with correct str and stringlen parameters and JSON_TOKENER_STRICT flag is set. Please help!
When I check "jerr" it does not through any error. How to validate the json string using json-c ?
json = json_tokener_parse(str);
if( json == NULL ) { printf ("Invalid JSON StringError"); }
tok = json_tokener_new();
json_tokener_set_flags(tok, JSON_TOKENER_STRICT);
json = json_tokener_parse_ex(tok, str, stringlen);
jerr = json_tokener_get_error(tok);
if (jerr != json_tokener_success ){
printf("Err Json Is Invalid string \n ");
fprintf(stderr, "Error: %s\n", json_tokener_error_desc(jerr));
}
The text was updated successfully, but these errors were encountered: