{"action":"created","issue":{"url":"https://api.github.com/repos/nlohmann/json/issues/8","labels_url":"https://api.github.com/repos/nlohmann/json/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/nlohmann/json/issues/8/comments","events_url":"https://api.github.com/repos/nlohmann/json/issues/8/events","html_url":"https://github.com/nlohmann/json/issues/8","id":53426032,"number":8,"title":"free functions for explicit objects and arrays in initializer lists","user":{"login":"nlohmann","id":159488,"avatar_url":"https://avatars.githubusercontent.com/u/159488?v=3","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},"labels":[{"url":"https://api.github.com/repos/nlohmann/json/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/nlohmann/json/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":{"login":"nlohmann","id":159488,"avatar_url":"https://avatars.githubusercontent.com/u/159488?v=3","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},"milestone":null,"comments":1,"created_at":"2015-01-05T18:21:37Z","updated_at":"2015-01-24T19:41:06Z","closed_at":"2015-01-24T19:41:06Z","body":"Currently,\r\n\r\n```cpp\r\n{{\"a\",\"b\"},{\"c\",\"d\"}}\r\n```\r\n\r\nwill be treated as object, and there is no way to express it as array of two arrays with two strings each.\r\n\r\nAs [tgockel](http://www.reddit.com/r/programming/comments/2rbj96/json_for_modern_c_what_if_json_was_part_of_modern/cnel666) points out:\r\n> I can't say it's a great solution, but in JSON Voorhees, I went with free functions called array and object to disambiguate the initializer_list syntax. It also solves the issue of {} ambiguously meaning an empty object or empty array (and accidentally making an array when given string_views or something).\r\n\r\nSuch free functions could solve the above problem:\r\n\r\n```cpp\r\n{array({\"a\",\"b\"}), array({\"c\",\"d\"})}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/nlohmann/json/issues/comments/71333908","html_url":"https://github.com/nlohmann/json/issues/8#issuecomment-71333908","issue_url":"https://api.github.com/repos/nlohmann/json/issues/8","id":71333908,"user":{"login":"nlohmann","id":159488,"avatar_url":"https://avatars.githubusercontent.com/u/159488?v=3","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},"created_at":"2015-01-24T19:41:06Z","updated_at":"2015-01-24T19:41:06Z","body":"The array\r\n\r\n```json\r\n[[\"a\",\"b\"], [\"c\",\"d\"]]\r\n```\r\n\r\ncan now be created with\r\n\r\n```cpp\r\n{json::array({\"a\", \"b\"}), json::array({\"c\", \"d\"})}\r\n```\r\n\r\nThereby `json::array` and `json::object` are functions to force a type in an initializer list."}}