Any JSON parsing library for Electron devices?

Is there any JSON parsing library available for Electron devices?

I tried to use StaticJsonBuffer but the compiler complains:

error: 'StaticJsonBuffer' does not name a type
1 Like

I think most people are using mustache templates and rolling their own parser using strtok() function.

I just tried the SparkJson library on the Electron and it worked fine. Make sure you pass the size of the static buffer as a template parameter to StaticJsonBuffer, like:

StaticJsonBuffer<1000> jsonBuffer;
1 Like

What header files should I include?

If you are using the Particle Build (Web IDE) and add the SparkJson library to your application, it will automatically add the include header file:

#include "SparkJson/SparkJson.h"

But if you’ve copied the library into your source directory and are using Particle Dev (Atom IDE) or are doing a CLI compile, you need to

#include "SparkJson.h"

This whole weirdness with libraries and the difference between the different compilers is being worked on but right at the moment, that’s how it works.

It works. Thank you.

1 Like