0 votes
268 views
in General by
How to delete an ArduinoJson nested key?

I'm surely missing something here.

Wondering is there a way to delete a nested key somewhere?
for example, if I want to remove the "J" from this JSON obj?
{"H":{"K":"","J":"","M":0}}

Can .remove() do this?

not sure as it brings up this error

error: 'class ArduinoJson::Internals::JsonObjectSubscript<const char*>' has no member named 'remove'

thanks!

1 Answer

0 votes
by

If you are using the v5 of ArduinoJson

doc["H"].remove("J");

If you are using the v6 of ArduinoJson

JsonObject& hobj = root["H"];
hobj.remove("J");

Related questions

0 votes
1 answer 172 views
asked Sep 12, 2021 in Arduino by mithun (1.3k points)
0 votes
1 answer 131 views
0 votes
1 answer 143 views
asked Oct 4, 2021 in General by Tester Testee (220 points)
0 votes
1 answer 207 views
0 votes
2 answers 4.9k views
asked Jul 17, 2018 in General by anonymous
...