{"action":"created","issue":{"url":"https://api.github.com/repos/nitlang/nit/issues/2068","repository_url":"https://api.github.com/repos/nitlang/nit","labels_url":"https://api.github.com/repos/nitlang/nit/issues/2068/labels{/name}","comments_url":"https://api.github.com/repos/nitlang/nit/issues/2068/comments","events_url":"https://api.github.com/repos/nitlang/nit/issues/2068/events","html_url":"https://github.com/nitlang/nit/pull/2068","id":154499517,"number":2068,"title":"JSON: merge 2 services into `serialize_to_json` and isolate from `static`","user":{"login":"xymus","id":208057,"avatar_url":"https://avatars.githubusercontent.com/u/208057?v=3","gravatar_id":"","url":"https://api.github.com/users/xymus","html_url":"https://github.com/xymus","followers_url":"https://api.github.com/users/xymus/followers","following_url":"https://api.github.com/users/xymus/following{/other_user}","gists_url":"https://api.github.com/users/xymus/gists{/gist_id}","starred_url":"https://api.github.com/users/xymus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xymus/subscriptions","organizations_url":"https://api.github.com/users/xymus/orgs","repos_url":"https://api.github.com/users/xymus/repos","events_url":"https://api.github.com/users/xymus/events{/privacy}","received_events_url":"https://api.github.com/users/xymus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nitlang/nit/labels/need_review","name":"need_review","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-12T14:39:55Z","updated_at":"2016-05-12T18:31:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nitlang/nit/pulls/2068","html_url":"https://github.com/nitlang/nit/pull/2068","diff_url":"https://github.com/nitlang/nit/pull/2068.diff","patch_url":"https://github.com/nitlang/nit/pull/2068.patch"},"body":"The first goal of this PR is to create a simple but customizable service to write Nit objects to JSON (replacing `to_json_string` and `to_plain_json`). It also clarifies how the serialization of a single object can be customized by refining `accept_json_serializer` which allows the same customization of the existing recursive `to_json` but on any `Serializable` objects.\r\n\r\nThe second goal is to isolate `json::serialization` from `json::static`. This allows to hide the complexity of `static` to clients of `serialization` and will help to deprecate the `static` writing services. After this PR, `serialization` uses really only one service from `static`, `String::to_json` which escapes strings. While `paser_json` uses the new @R4PaSs implementation. The types of `static` didn't add any useful services in the context of the `JsonDeserializer` (they only have writing services) and added both complexity and dependencies to the module.\r\n\r\nAll of this would make it easy (if there is still interest) to unify all JSON writing APIs and replace the current `Jsonable::to_json` with a single `Serializable::to_json` using the implementation of the new method `serialize_to_json`. And we can update the existing `redef fun to_json` to `redef fun accept_json_serializer`  writing to a stream instead of a string."},"comment":{"url":"https://api.github.com/repos/nitlang/nit/issues/comments/218845646","html_url":"https://github.com/nitlang/nit/pull/2068#issuecomment-218845646","issue_url":"https://api.github.com/repos/nitlang/nit/issues/2068","id":218845646,"user":{"login":"privat","id":135828,"avatar_url":"https://avatars.githubusercontent.com/u/135828?v=3","gravatar_id":"","url":"https://api.github.com/users/privat","html_url":"https://github.com/privat","followers_url":"https://api.github.com/users/privat/followers","following_url":"https://api.github.com/users/privat/following{/other_user}","gists_url":"https://api.github.com/users/privat/gists{/gist_id}","starred_url":"https://api.github.com/users/privat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/privat/subscriptions","organizations_url":"https://api.github.com/users/privat/orgs","repos_url":"https://api.github.com/users/privat/repos","events_url":"https://api.github.com/users/privat/events{/privacy}","received_events_url":"https://api.github.com/users/privat/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T18:31:58Z","updated_at":"2016-05-12T18:31:58Z","body":"test this please"}}