Any idea why there is no matching function call for the dynamic json buffer? The header file exists in SparkJson. Is this related to the problem that the ArduinoJson library won’t load?
no matching function for call to 'ArduinoJson::DynamicJsonBuffer::DynamicJsonBuffer(const size_t&)'
It would help if you could tell us:
-what device you’re targeting
-what library you’re trying to use
-which IDE you’re using
-which system version you’re using
-what your actual code looks like
-preferably a share link from the web IDE so we can one-click duplicate your project including libraries
I was able to get your code to compile by using this buffer declaration:
StaticJsonBuffer<500> jsonBuffer;
This also works:
StaticJsonBuffer<bufferSize> jsonBuffer;
When I was using your Dynamic declaration, it wouldn’t compile. Also, you are putting the buffer size in parentheses after the variable name instead of in <> after the variable type. I do not believe you can use the dynamic declaration as as a global variable. You have to use dynamic inside of a function. Perhaps @Moors7 or @ScruffR can confirm that since my C++ skills are not that good.
That’s exactly the difference between a static and a dynamic buffer.
The static version has a given size, the dynamic one will start of empty and grow as needed.
According to the ArduinoJson assistant it appears that the dynamic buffer is declared globally and takes the buffer size as defined in my code, but maybe I am not reading this correctly or not understanding your suggestions.
SparkJson is a fork from a very old version of ArduinoJson.
At that time, DynamicJsonBuffer's constructor didn’t take any argument.
I highly recommend that you switch to ArduinoJson 5.13.
@bblanchon, if you’d ever happen to update the Spark/Particle library, could you please add a GitHub link to the library to get to your repo directly from Web IDE.
e.g. like this
Thanks for the info. Do you know what version of ArduinoJson is in the on-line Particle library? I can’t seem to get ArduinoJson library to load using the on-line Particle compiler, to be specific, if I select libraries in the on-line compiler. and then ArduinoJson it just hangs while loading. This seems to be an issue with Particle and not ArduinoJson specifically.