{"action":"created","issue":{"url":"https://api.github.com/repos/bblanchon/ArduinoJson/issues/343","repository_url":"https://api.github.com/repos/bblanchon/ArduinoJson","labels_url":"https://api.github.com/repos/bblanchon/ArduinoJson/issues/343/labels{/name}","comments_url":"https://api.github.com/repos/bblanchon/ArduinoJson/issues/343/comments","events_url":"https://api.github.com/repos/bblanchon/ArduinoJson/issues/343/events","html_url":"https://github.com/bblanchon/ArduinoJson/issues/343","id":173668406,"number":343,"title":"Recursively entering Json object based on string","user":{"login":"tttapa","id":21296729,"avatar_url":"https://avatars.githubusercontent.com/u/21296729?v=3","gravatar_id":"","url":"https://api.github.com/users/tttapa","html_url":"https://github.com/tttapa","followers_url":"https://api.github.com/users/tttapa/followers","following_url":"https://api.github.com/users/tttapa/following{/other_user}","gists_url":"https://api.github.com/users/tttapa/gists{/gist_id}","starred_url":"https://api.github.com/users/tttapa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tttapa/subscriptions","organizations_url":"https://api.github.com/users/tttapa/orgs","repos_url":"https://api.github.com/users/tttapa/repos","events_url":"https://api.github.com/users/tttapa/events{/privacy}","received_events_url":"https://api.github.com/users/tttapa/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bblanchon/ArduinoJson/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-28T21:19:04Z","updated_at":"2016-08-29T17:11:35Z","closed_at":null,"body":"Hello, I've got the following json object:\r\n```JSON\r\n{\r\n    \"ESP_IN_PC_OUT\":{\r\n        \"track\":{\r\n            \"1\":{\r\n                \"mute\":{\r\n                    \"type\":\"LED\",\r\n                    \"pins\":[4]\r\n                }\r\n            },\r\n            \"2\":{\r\n                \"mute\":{\r\n                    \"type\":\"LED\",\r\n                    \"pins\":[5]\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\nI want to enter the object, depending on a string of the format \"/index1/index2/index3 ...\". For example, \"/track/2/mute\" should return a Json object like this:\r\n```JSON\r\n{\r\n    \"type\":\"LED\",\r\n    \"pins\":[5]\r\n}\r\n```\r\nI'm using an ESP8266. This is the code I've tried:\r\n```Arduino\r\n#include <ArduinoJson.h>\r\n\r\nchar *jsonstr = \"{\\n    \\\"ESP_IN_PC_OUT\\\":{\\n        \\\"track\\\":{\\n            \\\"1\\\":{\\n                \\\"mute\\\":{\\n                    \\\"type\\\":\\\"LED\\\",\\n                    \\\"pins\\\":[4]\\n                }\\n            },\\n            \\\"2\\\":{\\n                \\\"mute\\\":{\\n                    \\\"type\\\":\\\"LED\\\",\\n                    \\\"pins\\\":[5]\\n                }\\n            }\\n        }\\n    },\\n\\n\\n    \\\"ESP_OUT_PC_IN\\\":{\\n        \\\"analog\\\":{\\n        },\\n        \\\"digital\\\":{\\n            \\\"16\\\":\\\"/track/1/mute\\\"\\n        }\\n    }\\n}\"; \r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n\r\n  DynamicJsonBuffer jsonBuffer;\r\n\r\n  JsonObject& root = jsonBuffer.parseObject(jsonstr);\r\n  if (!root.success()) {\r\n    Serial.println(\"parseObject() failed\");\r\n    return;\r\n  }\r\n\r\n  Serial.println((const char*) root[\"ESP_IN_PC_OUT\"][\"track\"][\"2\"][\"mute\"][\"type\"]); // prints \"LED\"\r\n  Serial.println();\r\n  \r\n  char *address = \"/track/2/mute\";\r\n  char *tmp = strtok(address,\"/\");\r\n  JsonObject& tmpJson = root[\"ESP_IN_PC_OUT\"];\r\n  bool success = true;\r\n  while(tmp != NULL && success == true){\r\n    Serial.println(tmp);\r\n    if(tmpJson.containsKey(tmp)){\r\n      tmpJson = tmpJson[tmp];        // Error: use of deleted function 'ArduinoJson::JsonObject& ArduinoJson::JsonObject::operator=(const ArduinoJson::JsonObject&)'\r\n      tmp = strtok(NULL,\"/\");\r\n    } else {\r\n      success = false;\r\n    }\r\n  }\r\n  if(success == true){\r\n    Serial.println((const char*)tmpJson[\"type\"]);\r\n  } else {\r\n    Serial.println(\"Address not found\");\r\n  }\r\n}\r\n\r\nvoid loop() {\r\n}\r\n```\r\nHowever, this gives me the following error message:\r\n```\r\nJSON_OSC_settings2:26: error: use of deleted function 'ArduinoJson::JsonObject& ArduinoJson::JsonObject::operator=(const ArduinoJson::JsonObject&)'\r\n\r\n       tmpJson = tmpJson[tmp];\r\n\r\n               ^\r\n\r\nIn file included from C:\\Users\\Pieter\\Documents\\Arduino\\libraries\\ArduinoJson-master/include/ArduinoJson.hpp:12:0,\r\n\r\n                 from C:\\Users\\Pieter\\Documents\\Arduino\\libraries\\ArduinoJson-master/include/ArduinoJson.h:8,\r\n\r\n                 from C:\\Users\\Pieter\\Documents\\Arduino\\libraries\\ArduinoJson-master/ArduinoJson.h:8,\r\n\r\n                 from C:\\Users\\Pieter\\Documents\\Arduino\\JSON_OSC_settings2\\JSON_OSC_settings2.ino:1:\r\n\r\nC:\\Users\\Pieter\\Documents\\Arduino\\libraries\\ArduinoJson-master/include/ArduinoJson/JsonObject.hpp:38:7: note: 'ArduinoJson::JsonObject& ArduinoJson::JsonObject::operator=(const ArduinoJson::JsonObject&)' is implicitly deleted because the default definition would be ill-formed:\r\n\r\n class JsonObject : public Internals::JsonPrintable<JsonObject>,\r\n\r\n       ^\r\n\r\nIn file included from C:\\Users\\Pieter\\Documents\\Arduino\\libraries\\ArduinoJson-master/include/ArduinoJson/JsonArray.hpp:13:0,\r\n\r\n                 from C:\\Users\\Pieter\\Documents\\Arduino\\libraries\\ArduinoJson-master/include/ArduinoJson.hpp:11,\r\n\r\n                 from C:\\Users\\Pieter\\Documents\\Arduino\\libraries\\ArduinoJson-master/include/ArduinoJson.h:8,\r\n\r\n                 from C:\\Users\\Pieter\\Documents\\Arduino\\libraries\\ArduinoJson-master/ArduinoJson.h:8,\r\n\r\n                 from C:\\Users\\Pieter\\Documents\\Arduino\\JSON_OSC_settings2\\JSON_OSC_settings2.ino:1:\r\n\r\nC:\\Users\\Pieter\\Documents\\Arduino\\libraries\\ArduinoJson-master/include/ArduinoJson/Internals/ReferenceType.hpp:32:18: error: 'ArduinoJson::Internals::ReferenceType& ArduinoJson::Internals::ReferenceType::operator=(const ArduinoJson::Internals::ReferenceType&)' is private\r\n\r\n   ReferenceType& operator=(const ReferenceType&);\r\n\r\n                  ^\r\n\r\nIn file included from C:\\Users\\Pieter\\Documents\\Arduino\\libraries\\ArduinoJson-master/include/ArduinoJson.hpp:12:0,\r\n\r\n                 from C:\\Users\\Pieter\\Documents\\Arduino\\libraries\\ArduinoJson-master/include/ArduinoJson.h:8,\r\n\r\n                 from C:\\Users\\Pieter\\Documents\\Arduino\\libraries\\ArduinoJson-master/ArduinoJson.h:8,\r\n\r\n                 from C:\\Users\\Pieter\\Documents\\Arduino\\JSON_OSC_settings2\\JSON_OSC_settings2.ino:1:\r\n\r\nC:\\Users\\Pieter\\Documents\\Arduino\\libraries\\ArduinoJson-master/include/ArduinoJson/JsonObject.hpp:38:7: error: within this context\r\n\r\n class JsonObject : public Internals::JsonPrintable<JsonObject>,\r\n\r\n       ^\r\n\r\nexit status 1\r\nuse of deleted function 'ArduinoJson::JsonObject& ArduinoJson::JsonObject::operator=(const ArduinoJson::JsonObject&)'\r\n```\r\nHow can I solve this?\r\n\r\nThanks in advance!\r\nPieter"},"comment":{"url":"https://api.github.com/repos/bblanchon/ArduinoJson/issues/comments/243188202","html_url":"https://github.com/bblanchon/ArduinoJson/issues/343#issuecomment-243188202","issue_url":"https://api.github.com/repos/bblanchon/ArduinoJson/issues/343","id":243188202,"user":{"login":"bblanchon","id":5462433,"avatar_url":"https://avatars.githubusercontent.com/u/5462433?v=3","gravatar_id":"","url":"https://api.github.com/users/bblanchon","html_url":"https://github.com/bblanchon","followers_url":"https://api.github.com/users/bblanchon/followers","following_url":"https://api.github.com/users/bblanchon/following{/other_user}","gists_url":"https://api.github.com/users/bblanchon/gists{/gist_id}","starred_url":"https://api.github.com/users/bblanchon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bblanchon/subscriptions","organizations_url":"https://api.github.com/users/bblanchon/orgs","repos_url":"https://api.github.com/users/bblanchon/repos","events_url":"https://api.github.com/users/bblanchon/events{/privacy}","received_events_url":"https://api.github.com/users/bblanchon/received_events","type":"User","site_admin":false},"created_at":"2016-08-29T17:11:35Z","updated_at":"2016-08-29T17:11:35Z","body":"PS: I added this to the FAQ: [How to assign a JsonArray or JsonObject?](https://github.com/bblanchon/ArduinoJson/wiki/FAQ#how-to-assign-a-jsonarray-or-jsonobject)"}}
{"actor":{"display_login":"bblanchon"}}