{"action":"created","issue":{"url":"https://api.github.com/repos/miloyip/rapidjson/issues/389","labels_url":"https://api.github.com/repos/miloyip/rapidjson/issues/389/labels{/name}","comments_url":"https://api.github.com/repos/miloyip/rapidjson/issues/389/comments","events_url":"https://api.github.com/repos/miloyip/rapidjson/issues/389/events","html_url":"https://github.com/miloyip/rapidjson/issues/389","id":95757490,"number":389,"title":"Got issue get value from a deep nested Json object","user":{"login":"ourlord","id":3281175,"avatar_url":"https://avatars.githubusercontent.com/u/3281175?v=3","gravatar_id":"","url":"https://api.github.com/users/ourlord","html_url":"https://github.com/ourlord","followers_url":"https://api.github.com/users/ourlord/followers","following_url":"https://api.github.com/users/ourlord/following{/other_user}","gists_url":"https://api.github.com/users/ourlord/gists{/gist_id}","starred_url":"https://api.github.com/users/ourlord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ourlord/subscriptions","organizations_url":"https://api.github.com/users/ourlord/orgs","repos_url":"https://api.github.com/users/ourlord/repos","events_url":"https://api.github.com/users/ourlord/events{/privacy}","received_events_url":"https://api.github.com/users/ourlord/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-17T22:31:08Z","updated_at":"2015-07-25T07:50:09Z","closed_at":"2015-07-25T07:50:09Z","body":"Say I have a nested Json object shown as below. Except those field `level1`, `level2`, `level3`, `my_goal`, other fields are all generated randomly from somewhere else which I can never know its value in compile time, which needs me to use iterator. \r\n\r\nWhat would be the best way to fetch the value of `my_goal` in this case? I've already worked out a little but get stuck. My example code lists below.\r\n\r\n```\r\n{\r\n  \"level1\" : \"value\",\r\n  \"level2\" : {\r\n    \"qwjeqlwe\" : {\r\n      \"level3\" : {\r\n        \"my_goal\" : \"...\"\r\n        ....\r\n      }\r\n    } ,\r\n    \"qweq123123\" : {\r\n      \"level3\" : {\r\n         \"my_goal\" : \"...\"\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n```\r\naJsonString = ...; // As shown above\r\nDocument d;\r\nd.Parse(aJsonString);\r\nif (d.HasMember(\"level2\")) \r\n{\r\n  for (auto itr = d[\"level2\"].MemberBegin(); // use auto here to save from typing\r\n     itr != d[\"level2\"].MemberEnd(); ++itr) \r\n  {\r\n    // Got stuck here, don't know what exactly is itr point to\r\n    if (itr[\"level3\"].HasMemeber(\"my_goal\")) // if this correct?\r\n    { ... }\r\n  }\r\n}\r\n```\r\n\r\n\r\nThe real scenario is even more complicated than this. So I wish to find a smart way to navigate and find the value I'm looking for. But for now, at least I know the path to the value I wish to find, i.e. `root -> level2 -> itr -> level3 -> my_goal`.\r\n\r\nAnd I've found some workaround say can use `findMember` this kind of method call. But got no idea how to work with that.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/miloyip/rapidjson/issues/comments/124817753","html_url":"https://github.com/miloyip/rapidjson/issues/389#issuecomment-124817753","issue_url":"https://api.github.com/repos/miloyip/rapidjson/issues/389","id":124817753,"user":{"login":"miloyip","id":1195774,"avatar_url":"https://avatars.githubusercontent.com/u/1195774?v=3","gravatar_id":"","url":"https://api.github.com/users/miloyip","html_url":"https://github.com/miloyip","followers_url":"https://api.github.com/users/miloyip/followers","following_url":"https://api.github.com/users/miloyip/following{/other_user}","gists_url":"https://api.github.com/users/miloyip/gists{/gist_id}","starred_url":"https://api.github.com/users/miloyip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miloyip/subscriptions","organizations_url":"https://api.github.com/users/miloyip/orgs","repos_url":"https://api.github.com/users/miloyip/repos","events_url":"https://api.github.com/users/miloyip/events{/privacy}","received_events_url":"https://api.github.com/users/miloyip/received_events","type":"User","site_admin":false},"created_at":"2015-07-25T07:50:09Z","updated_at":"2015-07-25T07:50:09Z","body":"Yes. Your solution is corrected."}}