{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/JSON.jl/issues/150","repository_url":"https://api.github.com/repos/JuliaLang/JSON.jl","labels_url":"https://api.github.com/repos/JuliaLang/JSON.jl/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/JSON.jl/issues/150/comments","events_url":"https://api.github.com/repos/JuliaLang/JSON.jl/issues/150/events","html_url":"https://github.com/JuliaLang/JSON.jl/issues/150","id":161060290,"number":150,"title":"Better custom serialization API?","user":{"login":"TotalVerb","id":12903942,"avatar_url":"https://avatars.githubusercontent.com/u/12903942?v=3","gravatar_id":"","url":"https://api.github.com/users/TotalVerb","html_url":"https://github.com/TotalVerb","followers_url":"https://api.github.com/users/TotalVerb/followers","following_url":"https://api.github.com/users/TotalVerb/following{/other_user}","gists_url":"https://api.github.com/users/TotalVerb/gists{/gist_id}","starred_url":"https://api.github.com/users/TotalVerb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TotalVerb/subscriptions","organizations_url":"https://api.github.com/users/TotalVerb/orgs","repos_url":"https://api.github.com/users/TotalVerb/repos","events_url":"https://api.github.com/users/TotalVerb/events{/privacy}","received_events_url":"https://api.github.com/users/TotalVerb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-19T07:13:27Z","updated_at":"2016-06-19T16:55:24Z","closed_at":null,"body":"A lot of packages are overloading `JSON._print`. From what I understand, this method is supposed to be internal (its leading underscore and all) but that has not stopped [packages from using it](https://github.com/search?l=&q=%22JSON._print%22+language%3AJulia&ref=advsearch&type=Code&utf8=%E2%9C%93).\r\n\r\nThis is not desirable, because:\r\n\r\n - Packages need to reimplement a lot of serialization code, like how to serialize dicts and arrays.\r\n - Overloads of `JSON._print` can write _anything_ — including stuff that isn't JSON. This isn't good.\r\n - Packages tend to depend on implementation details, like what the name of `JSON.separator` is.\r\n\r\nI think a better serialization API, similar to Python's, would help lots. For instance:\r\n\r\n - Introduce `JSON.lower`, designed to be overloaded, that converts an object to another \"primitive\" object that `JSON` can serialize (`Dict`, `Array`, etc.).\r\n - In the generic `JSON._print` fallback, call `JSON.lower` instead of the current dumping behaviour\r\n - Add a generic `JSON.lower` fallback that does the current dumping behaviour\r\n\r\nThen:\r\n\r\n - Deprecate overloading `JSON._print`. I'm not sure if there's actually a way to do this. At least, going through the GitHub search above is a good start.\r\n - Document which methods are public. This is especially important because nothing is exported, so there is no implicit understanding of which methods should be used, and which are internal. This will help avoid breakages like PlotlyJS in the future."},"comment":{"url":"https://api.github.com/repos/JuliaLang/JSON.jl/issues/comments/227007832","html_url":"https://github.com/JuliaLang/JSON.jl/issues/150#issuecomment-227007832","issue_url":"https://api.github.com/repos/JuliaLang/JSON.jl/issues/150","id":227007832,"user":{"login":"TotalVerb","id":12903942,"avatar_url":"https://avatars.githubusercontent.com/u/12903942?v=3","gravatar_id":"","url":"https://api.github.com/users/TotalVerb","html_url":"https://github.com/TotalVerb","followers_url":"https://api.github.com/users/TotalVerb/followers","following_url":"https://api.github.com/users/TotalVerb/following{/other_user}","gists_url":"https://api.github.com/users/TotalVerb/gists{/gist_id}","starred_url":"https://api.github.com/users/TotalVerb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TotalVerb/subscriptions","organizations_url":"https://api.github.com/users/TotalVerb/orgs","repos_url":"https://api.github.com/users/TotalVerb/repos","events_url":"https://api.github.com/users/TotalVerb/events{/privacy}","received_events_url":"https://api.github.com/users/TotalVerb/received_events","type":"User","site_admin":false},"created_at":"2016-06-19T16:55:24Z","updated_at":"2016-06-19T16:55:24Z","body":"This overall seems like a fairly minimal change. I'll implement a proof-of-concept and submit a PR later today."}}
{"actor":{"display_login":"TotalVerb"}}