JSON parser for Spark

I ported a JSON parser called JSMN pointed out by Bdub. It is small and fast. If anyone is interested, I put the library and test code on my github.

:smile:

9 Likes

What? Yay! That’s sweet!

VERY NICE @peekay123! Can’t wait to throw some big chunks of data at it and see what comes out.

1 Like

thanks @peekay123 just what i needed!

@peekay123 Yo!

I think I might be in the right place for something I’m trying to accomplish, you can let me know.

I have the Spark Core and the SHT-15 temp & humidity sensor up and running with the data being pushed to the spark cloud and then pulled into my Google Drive Spreadsheet via a script so I can log + graph out the temp data over time.

Now I have been using this for awhile now and it works great but now I want to also have the outside temp and humidity data on the same graph also so I can see the difference between inside and outside temp differences.

What do you think is the easiest way to get my local temp and humidity data pushed into my Google Drive Spreadsheet so I can graph it along with temp and humidity inside?

Is the simple JSON parser able to do this job? How could it work in plain english for this beginner over here :smile:

RWB, it would seem to me you should be pulling it directly from you google script and not through your core. I did a quick google of “pull local weather data into google speadsheet” and found this openWeatherMap free item. You could pull your data using JSON and parse it just like you get the data from the core. :smile:

I get the following errors: http://pastebin.com/MYRAh2ye

It looks like NULL and size_t are not defined. I’ve tried searching around it and looks like they SHOULD be defined but perhaps I’m doing something wrong?

harrisonhjones, you need to add #include “application.h” in the jsmnSpark.h file. I posted that before that became a requirement!

3 Likes

Sorry i test JSMN

and change jsmndemo.cpp
js = “{“token”:123456789,“barcode”:[123456789,“barcode01”],“quantity”:[1,5]}”;

and resulte = parse failed

how syntax is work ?

i test API me
request
token: 123456789,
barcode: [ ‘barcode3’, ‘barcode3’ ],
quantity: [ 1, 1 ] }

response
[{“info”:{“api”:“Summit API Beep to buy”,“customerid”:“0000000000”,“name”:{“firstname”:“admin”,“lastname”:“admin”},“total”:60,“token”:123456789,“detail”:[{“prodname”:“barcode3”,“unitprice”:30},{“prodname”:“barcode3”,“unitprice”:30}]}}]

i want to parse to array obj
prodname[ ] , unitprice[ ] ,

@fangda01, you can get the documentation for the orignal code here:

https://bitbucket.org/zserge/jsmn/wiki/Home