[SOLVED] Issues with compiling the SparkJson library

Mod edit (@harrisonhjones): Solution: See the next post down

The SparkJson library is currently listed as broken on all platforms according to the particle cloud IDE. I searched the forum and nobody seems to have discussed this anywhere? I tried compiling anyways so I could use the glowfish httpsclient library which uses SparkJson as a dependency, and it has issues casting types (it appears).

I tried using the glowfish example:

top['coreid'] = (const char*) System.deviceID();

which results in:

error: invalid conversion from 'int' to 'ArduinoJson::JsonObject::key_type {aka const char*}

Anyone have any ideas? Has anyone duplicated this error?

These indicators are not to be trusted since the lib examples are auto-tested which doesn’t account for required secondary library includes or “obvious” easily repaired by the sample user.
And the demos in that lib are not taking into account that Particle Build is a bit arkward about the includes.
Try adapting them like this

// this is the original
//#include <ArduinoJson.h>
// but should be this
#include "SparkJson/ArduinoJson.h"

For your error

The single quotes (') should actually be double quotes ("), since singles are only for single characters.

2 Likes

Works like a charm. Thank you!

1 Like