{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/14493","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/14493/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/14493/comments","events_url":"https://api.github.com/repos/golang/go/issues/14493/events","html_url":"https://github.com/golang/go/issues/14493","id":136143162,"number":14493,"title":"encoding/json: RawMessage marshals as base64","user":{"login":"niemeyer","id":378683,"avatar_url":"https://avatars.githubusercontent.com/u/378683?v=3","gravatar_id":"","url":"https://api.github.com/users/niemeyer","html_url":"https://github.com/niemeyer","followers_url":"https://api.github.com/users/niemeyer/followers","following_url":"https://api.github.com/users/niemeyer/following{/other_user}","gists_url":"https://api.github.com/users/niemeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/niemeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niemeyer/subscriptions","organizations_url":"https://api.github.com/users/niemeyer/orgs","repos_url":"https://api.github.com/users/niemeyer/repos","events_url":"https://api.github.com/users/niemeyer/events{/privacy}","received_events_url":"https://api.github.com/users/niemeyer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/6","html_url":"https://github.com/golang/go/milestones/Unplanned","labels_url":"https://api.github.com/repos/golang/go/milestones/6/labels","id":1055141,"number":6,"title":"Unplanned","description":"No plan to fix in any specific release.\r\n","creator":{"login":"rsc","id":104030,"avatar_url":"https://avatars.githubusercontent.com/u/104030?v=3","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":1310,"closed_issues":334,"state":"open","created_at":"2015-04-06T20:47:19Z","updated_at":"2016-04-10T18:27:02Z","due_on":"2099-12-31T05:00:00Z","closed_at":null},"comments":13,"created_at":"2016-02-24T18:16:33Z","updated_at":"2016-04-10T18:44:26Z","closed_at":null,"body":"The encoding/json package marshals RawMessage properly or incorrectly as base64 based on whether its container is marshaled by value or as a pointer, which is extremely subtle and trivial to get wrong silently.\r\n\r\nIt also consistently fails to marshal the RawMessage value properly when used as a map value type.\r\n\r\nSample code demonstrating these problems:\r\n\r\nhttps://play.golang.org/p/bHuvfyb7qB\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/208042346","html_url":"https://github.com/golang/go/issues/14493#issuecomment-208042346","issue_url":"https://api.github.com/repos/golang/go/issues/14493","id":208042346,"user":{"login":"rogpeppe","id":66491,"avatar_url":"https://avatars.githubusercontent.com/u/66491?v=3","gravatar_id":"","url":"https://api.github.com/users/rogpeppe","html_url":"https://github.com/rogpeppe","followers_url":"https://api.github.com/users/rogpeppe/followers","following_url":"https://api.github.com/users/rogpeppe/following{/other_user}","gists_url":"https://api.github.com/users/rogpeppe/gists{/gist_id}","starred_url":"https://api.github.com/users/rogpeppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogpeppe/subscriptions","organizations_url":"https://api.github.com/users/rogpeppe/orgs","repos_url":"https://api.github.com/users/rogpeppe/repos","events_url":"https://api.github.com/users/rogpeppe/events{/privacy}","received_events_url":"https://api.github.com/users/rogpeppe/received_events","type":"User","site_admin":false},"created_at":"2016-04-10T18:44:26Z","updated_at":"2016-04-10T18:44:26Z","body":"The value method would cover the pointer type too because that's how Go\nmethods work.\n\nHowever as that issue demonstrates, it could indeed change behaviour where\ncode is currently expecting a RawMessage to marshal as a []byte, and that's\nprobably incompatible enough that we wouldn't want to change it.\n\nWhat a pity.\nOn 10 Apr 2016 18:05, \"Brad Fitzpatrick\" <notifications@github.com> wrote:\n\n> @rogpeppe <https://github.com/rogpeppe>, that wouldn't work:\n>\n> $ go install .\n> # encoding/json\n> ./stream.go:237: method redeclared: RawMessage.MarshalJSON\n>         method(*RawMessage) func() ([]byte, error)\n>         method(RawMessage) func() ([]byte, error)\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly or view it on GitHub\n> <https://github.com/golang/go/issues/14493#issuecomment-208017502>\n>\n"}}