-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nested Array can not contain other arrays? #51
Comments
Hi Christian, Signatures of
So, you should do:
Regards, |
Thanks for your assistance. Works now. Christian |
@bblanchon, is it possible to create an array of arrays with a variable name for the nested array. I want to encode a variable number of 3-value int data points (nested array) within an array. Using the approach above means hard-coding each nested array name which won't work in my case. Thanks! |
I may have found the solution in closed issues. It compiles but not sure if it works:
It's not an array of arrays but an object of arrays which will do the trick if it works. Thanks! |
@pkourany you're code looks ok, it should work fine |
Great!!! I'll test tonight. And thanks for a great library +1: |
Hi,
I like to do something like
JsonArray& data = root.createNestedArray("data");
JsonArray& data1 = data.createNestedArray("data1");
data1.add(48.756080, 6);
data1.add(2.302038, 6);
JsonArray& data2 = data.createNestedArray("data2");
data2.add(48.756080, 6);
data2.add(2.302038, 6);
data.add(data1);
data.add(data2);
But get this compilation error
JsonGeneratorExample.ino:19:52: error: no matching function for call to 'ArduinoJson::JsonArray::createNestedArray(const char [6])'
JsonGeneratorExample.ino:19:52: note: candidate is:
In file included from /home/cccc/Arduino_sketchbook/libraries/ArduinoJson/include/ArduinoJson.h:8:0,
from /home/cccc/Arduino_sketchbook/libraries/ArduinoJson/ArduinoJson.h:11,
from JsonGeneratorExample.ino:7:
/home/cccc/Arduino_sketchbook/libraries/ArduinoJson/include/../include/ArduinoJson/JsonArray.hpp:68:14: note: ArduinoJson::JsonArray& ArduinoJson::JsonArray::createNestedArray()
JsonArray &createNestedArray();
My JSON string should look like this {"sensor":"gps","time":1351824120,"data":[[48.756080,2.302038],[48.756080,2.302038]]}
Isn't this possible or where is my error?
Best Christian
The text was updated successfully, but these errors were encountered: