Skip to content

Issue when trying to add an Object to a nested array #493

Closed
@Alexpelillo

Description

@Alexpelillo

Hi BBlanchon, I can't thank you enough for making this library, but as I'm trying to make a system that loads a structure from memory filesystem (Developing on esp8266 NodeMcu with Arduino IDE), the only resort that i'm encountering right now is this one:
The structure is like this:
{"Devices":[
{"Device":"Circutor CVM-mini",
"Vars":[
{"VrName":"VRMS",
"VrAddr":"20"}]}}]
With more than 1 device and with more than 1 variable each. I am able to load and store from memory, and delete variables too with array.removeAt()... (will try further to delete devices) But I can't create variables inside the vars array. Tried with varArray.createNestedObject() and then filling the Object with data, and tried with first creating the Object and then varArray.add(Jobject) and I keep getting issues with the ESP8266 rebooting and the stack is like this:

3fff0864: 00000014 00000014 40206ddc 3ffef0c0
3fff0874: 00000000 3ffef0c0 4020b469 3ffe89e8
3fff0884: 3fff0890 00000190 00000008 3fff0880
3fff0894: 00000000 736a2e69 00006e6f 3ffedd5c
3fff08a4: 00000000 4021eaa8 00000000 3ffefa84
3fff08b4: 00000013 00000013 4010020c 3ffe84c0
3fff08c4: 3ffef0c0 3fff0920 4010068c 00000031
3fff08d4: 0000000a 3fff2fec 4020f95c 3ffe84c0
3fff08e4: 3ffef0c0 3fff2fec 40206953 3ffefa84
3fff08f4: 00000012 00000012 3ffefa84 00000010
3fff0904: 3fff3034 00000000 4010053d 00000008
3fff0914: 00000000 00000020 40101c72 3ffe98e8
3fff0924: 4010191d 00000002 40101c72 3ffeda60
3fff0934: 40101806 00000001 00000000 00000000
3fff0944: 401015d3 00000000 3ffeda30 00000005
3fff0954: 00000000 00000020 40101c72 3ffe98e5
3fff0964: 40104f4f 3ffed370 3ffefa84 00000010
3fff0974: 3fff0a4c 00000000 4010053d 00000010
3fff0984: 3fff0a40 00000000 4010053d 3ffea184
3fff0994: 00000000 00000000 3fff3520 00000010
3fff09a4: 3fff0a4c 3fff0a4c 4020f24c 3ffe9518
3fff09b4: 00000000 3fff0a4c 4020f531 3ffe9518
3fff09c4: 00000000 3fff0a4c 00000001 00000001
3fff09d4: 3fff0a4c 3fff0a40 4020f5b4 3ffe0033
3fff09e4: 3fff0a90 3fff0a40 4020f445 3fff31f1
3fff09f4: 3ffe9608 3fff0a40 4020da7b 3ffefa84
3fff0a04: 00000451 00000451 4010020c 00000007
3fff0a14: 3fff0a90 3fff0a40 4010068c 00000000
3fff0a24: 00000000 00000000 4020f1f0 00000007
3fff0a34: 3fff0a90 3ffef0c0 3ffefa84 00000020
3fff0a44: 3fff0ad0 00000000 4010053d 3ffefa84
3fff0a54: 000003f5 000003f5 3ffefa84 00000020
3fff0a64: 3fff0af0 00000000 4020d53c 00000020
3fff0a74: 3fff0ad0 3fff0ad0 4020f24c 00000001
3fff0a84: 00000000 3fff0890 4020f29b 3ffefa84
3fff0a94: 000003d4 000003d4 4020d53c 00000001
3fff0aa4: 00000001 3fff25e4 4020b910 00000000
3fff0ab4: 3fffdad0 3fff25e4 4020d532 3fff25e4
3fff0ac4: 3ffef100 3fff25e4 4020d56e 00000000
3fff0ad4: 00000000 00000000 4020f3fc 3fff25e4
3fff0ae4: 3ffef100 3ffef0c0 4020d601 3fff31bc
3fff0af4: 0000001f 00000013 4020c588 3ffef100
3fff0b04: feefeffe 3ffefb70 00000001 00000001
3fff0b14: 4020cb44 0000000f 3ffefb70 00000000
3fff0b24: 00000000 3ffef0c0 3ffefb64 00000001
3fff0b34: 3ffef0e4 3ffef0c0 4020d7e3 3ffe8a30
3fff0b44: 00000000 000003e8 feefeffe 00000000
3fff0b54: 3fff3234 feefeffe feefeffe 3fffdad0
3fff0b64: 00000000 3ffefb5c 40206b98 3fffdad0
3fff0b74: 00000000 3ffefb5c 4020fa70 feefeffe
3fff0b84: feefeffe 3ffefb70 40100718 feefeffe
with exceptions (2) and (9) (if I try the first method or the second one) is it memory issue?
I have been optimising the code so there's only the Jobject root only one time opened and from there I access the subObjects and Arrays of Devices and Variables like this: root["Device"][number_of_device]["Vars"][variable]...

Metadata

Metadata

Assignees

No one assigned

    Labels

    v5ArduinoJson 5

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions