{"action":"created","issue":{"url":"https://api.github.com/repos/stleary/JSON-java/issues/295","repository_url":"https://api.github.com/repos/stleary/JSON-java","labels_url":"https://api.github.com/repos/stleary/JSON-java/issues/295/labels{/name}","comments_url":"https://api.github.com/repos/stleary/JSON-java/issues/295/comments","events_url":"https://api.github.com/repos/stleary/JSON-java/issues/295/events","html_url":"https://github.com/stleary/JSON-java/issues/295","id":184085946,"number":295,"title":"Improvement for JSONObject class","user":{"login":"kpopovic","id":1502762,"avatar_url":"https://avatars.githubusercontent.com/u/1502762?v=3","gravatar_id":"","url":"https://api.github.com/users/kpopovic","html_url":"https://github.com/kpopovic","followers_url":"https://api.github.com/users/kpopovic/followers","following_url":"https://api.github.com/users/kpopovic/following{/other_user}","gists_url":"https://api.github.com/users/kpopovic/gists{/gist_id}","starred_url":"https://api.github.com/users/kpopovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kpopovic/subscriptions","organizations_url":"https://api.github.com/users/kpopovic/orgs","repos_url":"https://api.github.com/users/kpopovic/repos","events_url":"https://api.github.com/users/kpopovic/events{/privacy}","received_events_url":"https://api.github.com/users/kpopovic/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-10-19T22:03:35Z","updated_at":"2016-10-20T01:40:13Z","closed_at":"2016-10-20T01:40:13Z","body":"Hello,\r\nplease add new methods to JSONObject class. I think the can be very useful.\r\n\r\nbyte[]\tgetBinary(String key) / byte[] getBinary(String key, byte[] def)\r\n------------------------------------------\r\nJSON itself has no notion of a binary, this extension complies to the RFC-7493, so this method assumes there is a String value with the key and it contains a Base64 encoded binary, which it decodes if found and returns.\r\n\r\npublic JsonObject put(String key, byte[] value)\r\n-------------------------------------------------------------\r\nPut a byte[] into the JSON object with the specified key.\r\nJSON extension RFC7493, binary will first be Base64 encoded before being put as a String.\r\n\r\npublic java.time.Instant getInstant(String key)\r\n------------------------------------------------------------\r\nGet the instant value with the specified key.\r\nJSON itself has no notion of a date, this extension complies to the RFC-7493, so this method assumes there is a String value with the key and it contains a ISODATE encoded date, which it decodes if found and returns.\r\n\r\nexample:\r\n public Instant getInstant(String key) {\r\n    Objects.requireNonNull(key);\r\n    String encoded = (String) map.get(key);\r\n    return encoded == null ? null : Instant.from(ISO_INSTANT.parse(encoded));\r\n  }\r\n\r\njava.time.Instant\tgetInstant(String key, java.time.Instant def)\r\nLike getInstant(String) but specifying a default value to return if there is no entry.\r\n-------------------------------------------------------------------------------------------------------------\r\nexample:\r\npublic Instant getInstant(String key, Instant def) {\r\n    Objects.requireNonNull(key);\r\n    Object val = map.get(key);\r\n    return val != null || map.containsKey(key) ?\r\n        (val == null ? null : Instant.from(ISO_INSTANT.parse((String) val))) : def;\r\n  }\r\npublic JsonObject put(String key, java.time.Instant value)\r\n-------------------------------------------------------------------------------------------------------------\r\nPut a Instant into the JSON object with the specified key.\r\nJSON extension RFC7493, instant will first be encoded to ISODATE String.\r\n\r\nexample:\r\nimport static java.time.format.DateTimeFormatter.ISO_INSTANT;\r\n.....\r\npublic JsonObject put(String key, Instant value) {\r\n    Objects.requireNonNull(key);\r\n    map.put(key, value == null ? null : ISO_INSTANT.format(value));\r\n    return this;\r\n  }\r\n\r\npublic JsonObject copy()\r\n........................................\r\nCopy the JSON object\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/stleary/JSON-java/issues/comments/254987367","html_url":"https://github.com/stleary/JSON-java/issues/295#issuecomment-254987367","issue_url":"https://api.github.com/repos/stleary/JSON-java/issues/295","id":254987367,"user":{"login":"stleary","id":5107558,"avatar_url":"https://avatars.githubusercontent.com/u/5107558?v=3","gravatar_id":"","url":"https://api.github.com/users/stleary","html_url":"https://github.com/stleary","followers_url":"https://api.github.com/users/stleary/followers","following_url":"https://api.github.com/users/stleary/following{/other_user}","gists_url":"https://api.github.com/users/stleary/gists{/gist_id}","starred_url":"https://api.github.com/users/stleary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stleary/subscriptions","organizations_url":"https://api.github.com/users/stleary/orgs","repos_url":"https://api.github.com/users/stleary/repos","events_url":"https://api.github.com/users/stleary/events{/privacy}","received_events_url":"https://api.github.com/users/stleary/received_events","type":"User","site_admin":false},"created_at":"2016-10-20T01:40:13Z","updated_at":"2016-10-20T01:40:13Z","body":"Not adding support for date or time transforms at this time. No objection if someone sees a need for Base64 and wants to try implementing it in a way that does not impact existing applications."}}
{"actor":{"display_login":"stleary"}}