{"action":"opened","issue":{"url":"https://api.github.com/repos/ralfstx/minimal-json/issues/52","labels_url":"https://api.github.com/repos/ralfstx/minimal-json/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/ralfstx/minimal-json/issues/52/comments","events_url":"https://api.github.com/repos/ralfstx/minimal-json/issues/52/events","html_url":"https://github.com/ralfstx/minimal-json/issues/52","id":83903082,"number":52,"title":"Introduce class Json for constants and static factory methods?","user":{"login":"ralfstx","id":255637,"avatar_url":"https://avatars.githubusercontent.com/u/255637?v=3","gravatar_id":"","url":"https://api.github.com/users/ralfstx","html_url":"https://github.com/ralfstx","followers_url":"https://api.github.com/users/ralfstx/followers","following_url":"https://api.github.com/users/ralfstx/following{/other_user}","gists_url":"https://api.github.com/users/ralfstx/gists{/gist_id}","starred_url":"https://api.github.com/users/ralfstx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralfstx/subscriptions","organizations_url":"https://api.github.com/users/ralfstx/orgs","repos_url":"https://api.github.com/users/ralfstx/repos","events_url":"https://api.github.com/users/ralfstx/events{/privacy}","received_events_url":"https://api.github.com/users/ralfstx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-02T08:07:40Z","updated_at":"2015-06-02T08:07:40Z","closed_at":null,"body":"With the constants `NULL`, `TRUE`, and `FALSE` defined on `JsonValue`, these constants are inherited by the subtypes of `JsonValue`. For example, the expression `JsonArray.TRUE` would compile although it doesn't make any sense. The same is true for static factory methods. The expression `JsonArray.valueOf(true)` would also compile and return `JsonValue.TRUE` which is not an instance of `JsonArray`.\r\n\r\nMoving these constants and factory methods to a dedicated class `Json` would solve these issues. Moreover, it would result in shorter and more concise code:\r\n\r\n`Json.NULL`, `Json.TRUE`, etc. instead of `JsonValue.NULL`, `JsonValue.TRUE`. \r\n\r\nWe could consider to rename the factory methods to `value` instead of `valueOf`.\r\n\r\n`Json.value(true)`, `Json.value(23)`...\r\n\r\nThis would also allow to add factory methods for arrays such as:\r\n\r\n`Json.array(23, 42)`, etc.\r\n"}}