{"action":"opened","issue":{"url":"https://api.github.com/repos/nlohmann/json/issues/283","repository_url":"https://api.github.com/repos/nlohmann/json","labels_url":"https://api.github.com/repos/nlohmann/json/issues/283/labels{/name}","comments_url":"https://api.github.com/repos/nlohmann/json/issues/283/comments","events_url":"https://api.github.com/repos/nlohmann/json/issues/283/events","html_url":"https://github.com/nlohmann/json/issues/283","id":166710747,"number":283,"title":"value() does not work with _json_pointer types","user":{"login":"clwill","id":1330725,"avatar_url":"https://avatars.githubusercontent.com/u/1330725?v=3","gravatar_id":"","url":"https://api.github.com/users/clwill","html_url":"https://github.com/clwill","followers_url":"https://api.github.com/users/clwill/followers","following_url":"https://api.github.com/users/clwill/following{/other_user}","gists_url":"https://api.github.com/users/clwill/gists{/gist_id}","starred_url":"https://api.github.com/users/clwill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clwill/subscriptions","organizations_url":"https://api.github.com/users/clwill/orgs","repos_url":"https://api.github.com/users/clwill/repos","events_url":"https://api.github.com/users/clwill/events{/privacy}","received_events_url":"https://api.github.com/users/clwill/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-21T00:13:45Z","updated_at":"2016-07-21T00:13:45Z","closed_at":null,"body":"It would be great if value(), which supports default values, worked like at() which can handle _json_pointer types.\r\n\r\nThis would allow the handling of nested objects, and still be robust to missing elements.\r\n\r\nTo wit:\r\n\r\n```\r\n#include <json.hpp>\r\n\r\nusing json = nlohmann::json;\r\n\r\nint main()\r\n{\r\n    json j =\r\n    {\r\n        {\"object\", {{\"key1\", 1}, {\"key2\", 2}}},\r\n    };\r\n\r\n    int at_integer = j.at(\"/object/key2\"_json_pointer);\r\n    int val_integer = j.value(\"/object/key2\"_json_pointer, 0);\r\n\r\n    std::cout << std::boolalpha << at_integer << \" \" << val_integer\r\n              << \" \" << (at_integer == val_integer) << \"\\n\";\r\n}\r\n```\r\n\r\nThis code produces the output:\r\n\r\n```\r\n2 0 false\r\n```\r\n\r\nWould be nice if it was `2 2 true`."}}
{"actor":{"display_login":"clwill"}}