I'm having an issue pulling all of the tokens from a JSON - I can get some of them, but not others. I'm using a Teensy 3.1 with 64K SRAM.
Here's two JSONs I've tested. In both case, the last few tokens are not parsed. Thinking it was a problem with the length of the JSON, I tried the 2nd JSON which is <32 tokens, so it's fairly small but still has the same issue:
-- does not parse measlights, measlights2, altc, and altd
{"protocol_name":"fluorescence","repeats":1,"wait":0,"averages":1,"measurements":3,"meas2_light":15,"meas1_baseline":0,"act_light":20,"pulsesize":25,"pulsedistance":10000,"actintensity1":50,"actintensity2":255,"measintensity":255,"calintensity":255,"pulses":[50,50,50],"act":[2,1,2,2],"red":[2,2,2,2],"detectors":[[34,34,34,34],[34,34,34,34],[34,34,34,34],[34,34,34,34]],"alta":[2,2,2,2],"altb":[2,2,2,2],"measlights":[[15,15,15,15],[15,15,15,15],[15,15,15,15],[15,15,15,15]],"measlights2":[[15,15,15,15],[15,15,15,15],[15,15,15,15],[15,15,15,15]],"altc":[2,2,2,2],"altd":[2,2,2,2]}
-- does not parse altc and altd
{"measlights":[[15],[15],[15],[15]],"end":[[15],[15],[15],[15]],"alta":[2,2],"altb":[2,2],"altc":[2,2],"altd":[2,2]}
I can't seem to get those last few values to be parsed correctly. And it's always the last few values - if you switch the order of the tokens, it's always the ones at the end which aren't parsed. It makes me think it's a memory issue, but I know that's not the case, the program is small and there's plenty of memory left. I've messed around with lots of things, like changing the JsonParser size, changing the varaible names, moving them around within the JSON itself, calling the values in a different way... but haven't been able to figure it out.
Any suggestions, ideas, or similar problems?
See attached for the code I used to test. Just enter any number followed by the JSON in the serial com window to parse (one of the above 2). It tries to find the variables it's looking for, it prints their values if they are found.
json_parser_testing.ino (14.6 KB)