JSMNSpark icon indicating copy to clipboard operation
JSMNSpark copied to clipboard

Long string

Open simetin opened this issue 10 years ago • 3 comments

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

simetin avatar Dec 30 '14 20:12 simetin

@tchinou1 , can you show how you declare p, r and tok?

pkourany avatar Dec 30 '14 20:12 pkourany

There are declare in the void loop like this: int i, r; jsmn_parser p; jsmntok_t tok[10]; char obj[20];

simetin avatar Dec 31 '14 05:12 simetin

@tchinou1, here is a link to the original author's documentation:

http://zserge.com/jsmn.html

pkourany avatar Dec 31 '14 13:12 pkourany