{"action":"created","issue":{"url":"https://api.github.com/repos/nlohmann/json/issues/399","repository_url":"https://api.github.com/repos/nlohmann/json","labels_url":"https://api.github.com/repos/nlohmann/json/issues/399/labels{/name}","comments_url":"https://api.github.com/repos/nlohmann/json/issues/399/comments","events_url":"https://api.github.com/repos/nlohmann/json/issues/399/events","html_url":"https://github.com/nlohmann/json/issues/399","id":196526937,"number":399,"title":"Finding a value in an array","user":{"login":"pboettch","id":442684,"avatar_url":"https://avatars3.githubusercontent.com/u/442684?v=4","gravatar_id":"","url":"https://api.github.com/users/pboettch","html_url":"https://github.com/pboettch","followers_url":"https://api.github.com/users/pboettch/followers","following_url":"https://api.github.com/users/pboettch/following{/other_user}","gists_url":"https://api.github.com/users/pboettch/gists{/gist_id}","starred_url":"https://api.github.com/users/pboettch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pboettch/subscriptions","organizations_url":"https://api.github.com/users/pboettch/orgs","repos_url":"https://api.github.com/users/pboettch/repos","events_url":"https://api.github.com/users/pboettch/events{/privacy}","received_events_url":"https://api.github.com/users/pboettch/received_events","type":"User","site_admin":false},"labels":[{"id":395133926,"url":"https://api.github.com/repos/nlohmann/json/labels/documentation","name":"documentation","color":"0e8a16","default":false},{"id":46374235,"url":"https://api.github.com/repos/nlohmann/json/labels/kind:%20question","name":"kind: question","color":"cc317c","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/nlohmann/json/milestones/15","html_url":"https://github.com/nlohmann/json/milestone/15","labels_url":"https://api.github.com/repos/nlohmann/json/milestones/15/labels","id":2201571,"number":15,"title":"Release 2.0.10","description":"The next release if backwards compatible bug fixes are introduced. A bug fix is defined as an internal change that fixes incorrect behavior.","creator":{"login":"nlohmann","id":159488,"avatar_url":"https://avatars2.githubusercontent.com/u/159488?v=4","gravatar_id":"","url":"https://api.github.com/users/nlohmann","html_url":"https://github.com/nlohmann","followers_url":"https://api.github.com/users/nlohmann/followers","following_url":"https://api.github.com/users/nlohmann/following{/other_user}","gists_url":"https://api.github.com/users/nlohmann/gists{/gist_id}","starred_url":"https://api.github.com/users/nlohmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlohmann/subscriptions","organizations_url":"https://api.github.com/users/nlohmann/orgs","repos_url":"https://api.github.com/users/nlohmann/repos","events_url":"https://api.github.com/users/nlohmann/events{/privacy}","received_events_url":"https://api.github.com/users/nlohmann/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":11,"state":"closed","created_at":"2016-12-16T20:36:52Z","updated_at":"2017-01-02T16:30:29Z","due_on":"2017-01-02T08:00:00Z","closed_at":"2017-01-02T15:58:51Z"},"comments":27,"created_at":"2016-12-19T21:38:01Z","updated_at":"2018-03-21T12:59:01Z","closed_at":"2017-01-02T16:30:28Z","author_association":"NONE","body":"I started using `nlohmann::json` today (thanks for it) and I wanted to check whether a certain value is contained in an array: I used `find()`. It compiled but it does not work.\r\n\r\n    #include <json.hpp>\r\n    using json = nlohmann::json;\r\n    int main(void)\r\n    {\r\n    \tjson j({\"hello\", \"world\"});\r\n    \tstd::cerr << j << \"\\n\";\r\n    \tstd::cerr << (j.find(\"hello\") != j.end()) << \" expecting 1\\n\";\r\n    \tfor (const auto &i: j)\r\n    \t\tif (i == \"hello\")\r\n    \t\t\tstd::cerr << \"found it while iterating\\n\";\r\n        return 0;\r\n    }\r\n\r\nit gives\r\n\r\n    [\"hello\",\"world\"]\r\n    0 expecting 1\r\n    found it while iterating\r\n\r\nReading json.hpp I saw that `find()` is often done with a key. What is the expected behavior of finding on an array?\r\n"},"comment":{"url":"https://api.github.com/repos/nlohmann/json/issues/comments/374927777","html_url":"https://github.com/nlohmann/json/issues/399#issuecomment-374927777","issue_url":"https://api.github.com/repos/nlohmann/json/issues/399","id":374927777,"user":{"login":"zvrba","id":630366,"avatar_url":"https://avatars1.githubusercontent.com/u/630366?v=4","gravatar_id":"","url":"https://api.github.com/users/zvrba","html_url":"https://github.com/zvrba","followers_url":"https://api.github.com/users/zvrba/followers","following_url":"https://api.github.com/users/zvrba/following{/other_user}","gists_url":"https://api.github.com/users/zvrba/gists{/gist_id}","starred_url":"https://api.github.com/users/zvrba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zvrba/subscriptions","organizations_url":"https://api.github.com/users/zvrba/orgs","repos_url":"https://api.github.com/users/zvrba/repos","events_url":"https://api.github.com/users/zvrba/events{/privacy}","received_events_url":"https://api.github.com/users/zvrba/received_events","type":"User","site_admin":false},"created_at":"2018-03-21T12:59:01Z","updated_at":"2018-03-21T12:59:01Z","author_association":"NONE","body":"I'm late to the discussion, but I've also just burned myself on this. I agree with people who think that `.find()` should throw if called on a non-object. Just like `.get<>` throws when called on null json."}}
{"actor":{"display_login":"zvrba"}}