{"action":"created","issue":{"url":"https://api.github.com/repos/lihaoyi/upickle/issues/55","labels_url":"https://api.github.com/repos/lihaoyi/upickle/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/lihaoyi/upickle/issues/55/comments","events_url":"https://api.github.com/repos/lihaoyi/upickle/issues/55/events","html_url":"https://github.com/lihaoyi/upickle/issues/55","id":54447623,"number":55,"title":"Configurable sum encoding","user":{"login":"tindzk","id":196819,"avatar_url":"https://avatars.githubusercontent.com/u/196819?v=3","gravatar_id":"","url":"https://api.github.com/users/tindzk","html_url":"https://github.com/tindzk","followers_url":"https://api.github.com/users/tindzk/followers","following_url":"https://api.github.com/users/tindzk/following{/other_user}","gists_url":"https://api.github.com/users/tindzk/gists{/gist_id}","starred_url":"https://api.github.com/users/tindzk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tindzk/subscriptions","organizations_url":"https://api.github.com/users/tindzk/orgs","repos_url":"https://api.github.com/users/tindzk/repos","events_url":"https://api.github.com/users/tindzk/events{/privacy}","received_events_url":"https://api.github.com/users/tindzk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-15T13:13:36Z","updated_at":"2015-01-17T22:41:59Z","closed_at":null,"body":"I need to parse the [Pandoc format](https://github.com/jgm/pandoc-types/blob/master/Text/Pandoc/Definition.hs) which is produced via [aeson](https://hackage.haskell.org/package/aeson). aeson supports configuring the sum encoding which is done as follows in Pandoc:\r\n\r\n```haskell\r\nAeson.sumEncoding = Aeson.TaggedObject \"t\" \"c\"\r\n```\r\n\r\nObviously, this consumes more space than the current approach chosen by uPickle:\r\n\r\n```scala\r\n  def annotate[V: ClassTag](rw: R[V], n: String) = R[V]{\r\n    case Js.Arr(Js.Str(`n`), x) => rw.read(x)\r\n  }\r\n```\r\n\r\nWould it be possible to not import ``annotate`` by default, so that I could define it manually?\r\n\r\nThis feature would significantly increase interoperability with other picklers as there doesn't seem to be a common standard on how to serialise classes."},"comment":{"url":"https://api.github.com/repos/lihaoyi/upickle/issues/comments/70387727","html_url":"https://github.com/lihaoyi/upickle/issues/55#issuecomment-70387727","issue_url":"https://api.github.com/repos/lihaoyi/upickle/issues/55","id":70387727,"user":{"login":"lihaoyi","id":934140,"avatar_url":"https://avatars.githubusercontent.com/u/934140?v=3","gravatar_id":"","url":"https://api.github.com/users/lihaoyi","html_url":"https://github.com/lihaoyi","followers_url":"https://api.github.com/users/lihaoyi/followers","following_url":"https://api.github.com/users/lihaoyi/following{/other_user}","gists_url":"https://api.github.com/users/lihaoyi/gists{/gist_id}","starred_url":"https://api.github.com/users/lihaoyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lihaoyi/subscriptions","organizations_url":"https://api.github.com/users/lihaoyi/orgs","repos_url":"https://api.github.com/users/lihaoyi/repos","events_url":"https://api.github.com/users/lihaoyi/events{/privacy}","received_events_url":"https://api.github.com/users/lihaoyi/received_events","type":"User","site_admin":false},"created_at":"2015-01-17T22:41:59Z","updated_at":"2015-01-17T22:41:59Z","body":"Possible. Would require some thought as to how to make it work well. Not sure whether typeclasses or virtual-classes would be the way to go for this "}}