JSON Serialize/Deserialize - still JSMN?

Just checking to see if there’s a preferred JSON serialization/deserialization library for the Photon. It sounds like (as of 2014) JSMN was preferred. I’ll need to both send and receive JSON, so my preference is something that can handle both sides.

So, if you’ve got a favorite library, let me know!

Note: In case it matters, I’m using Particle Dev (ie. local Atom IDE) so I’m trying to avoid things with a lot of files as it seems like the “all in the top folder” limitation is still in place and it’s already getting a bit crowded.

BTW, the main project plan is to have my Photon device passing and receiving messages via an MQTT broker (ie. Mosquitto). That means I can use any message interchange format I want, I just thought JSON would be the easiest for me to inspect and debug. But, if it’s easier to implement, I could also use Protocol Buffers and the nanopb library.

Essentially, I’m just looking for whatever will allow me to transmit messages the easiest. Speed and performance aren’t going to be an issue on this project.

Hi @micahwedemeyer,

in Particle Build there are some. I am using SparkJson library ported from here.

Thanks for the tip about SparkJson. I suppose I could dump all the files into my project folder and it would work. sigh

For now I’m going to play with nanopb a bit. I was able to define a simple message and get it all compiled and linked in my Particle code with a minimum of hassle. I’m not too keen on debugging a bunch of opaque binary though…

Libraries 2.0 will make that a lot easier.
You just have to tell the system to use a library and that’s it - no file copying required.

That will be good :wink:

Thanks for mentioning Libraries 2.0 It sounds right in line with what I’m looking for. Can’t wait to see it!

2 Likes