Open
Description
Hi,
I wrote a sample .ino to demonstrate the challenge from https://github.com/bblanchon/ArduinoJson/issues/1309 with descriptions in the serial printout. File is here: https://gist.github.com/jshep321/2b9ffb745edfa9dc121257656d811a07
Note that for the json format I would prefer an array for the "data" level, but the Google cloud database converts arrays to object automatically, so I'm a bit out of luck without restructuring the data or starting elsewhere!
Output from the program:
-----------initial json input string: -----------
{"USER1": { "data" : { "1" : "item 1 description", "2" : "item 2 description"}, "associated user data" : "value"}, "USER2": { "data" : { "10" : "item 10 description", "11" : "item 11 description"} ,"associated user data" : "value"}}
-----------fullUserDB after prettify (no filter yet): -----------
{
"USER1": {
"data": {
"1": "item 1 description",
"2": "item 2 description"
},
"associated user data": "value"
},
"USER2": {
"data": {
"10": "item 10 description",
"11": "item 11 description"
},
"associated user data": "value"
}
}
make a filter --
ideally I want to keep the target data of "10" and associated higher levels only
--> { USER2, data : { 10 : item 10 description }, associated user data: value } <--
Filter:
filter["*"]["data"]["10"] = true
-----------filtered userDB after pretty+filter: -----------
{
"USER1": {
"data": {}
},
"USER2": {
"data": {
"10": "item 10 description"
}
}
}
Result: Keeping unwanted USER1 and truncated wanted associated user data
Help appreciated or else I might have to do wonky stuff to search and filter this json object.
Thanks!