JSMNSpark
JSMNSpark copied to clipboard
Long string
Hi,
I'm getting an error when I'm trying to parse long json string (more than 8 string objects).
Here is the code conserne:
js = "[{"1":"ff0000","2": "301f0d","3": "301f0d","4":"0000ff","5":"0000ff"}]";
obj[0] = Serial.read();
Serial.print("test2");
jsmn_init(&p);
r = jsmn_parse(&p, js, tok, 10);
if (r == JSMN_SUCCESS)
Serial.println("parsed successfuly");
else {
Serial.println("parse failed");
return;
}
Thanks William Simetin-Grenon
@tchinou1 , can you show how you declare p, r and tok?
There are declare in the void loop like this: int i, r; jsmn_parser p; jsmntok_t tok[10]; char obj[20];
@tchinou1, here is a link to the original author's documentation:
http://zserge.com/jsmn.html