{"action":"created","issue":{"url":"https://api.github.com/repos/mobxjs/serializr/issues/74","repository_url":"https://api.github.com/repos/mobxjs/serializr","labels_url":"https://api.github.com/repos/mobxjs/serializr/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/mobxjs/serializr/issues/74/comments","events_url":"https://api.github.com/repos/mobxjs/serializr/issues/74/events","html_url":"https://github.com/mobxjs/serializr/issues/74","id":295877226,"number":74,"title":"Serializing \"any\" type","user":{"login":"AndrewMorsillo","id":858965,"avatar_url":"https://avatars3.githubusercontent.com/u/858965?v=4","gravatar_id":"","url":"https://api.github.com/users/AndrewMorsillo","html_url":"https://github.com/AndrewMorsillo","followers_url":"https://api.github.com/users/AndrewMorsillo/followers","following_url":"https://api.github.com/users/AndrewMorsillo/following{/other_user}","gists_url":"https://api.github.com/users/AndrewMorsillo/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewMorsillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewMorsillo/subscriptions","organizations_url":"https://api.github.com/users/AndrewMorsillo/orgs","repos_url":"https://api.github.com/users/AndrewMorsillo/repos","events_url":"https://api.github.com/users/AndrewMorsillo/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewMorsillo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-09T13:50:23Z","updated_at":"2018-02-09T16:05:28Z","closed_at":null,"author_association":"NONE","body":"Serializr seems to assume that the shape of objects are always fixed and that properties only ever have one type. \r\n\r\nWhat is the best method to serialize a property that may be of any type (ex: could be string, number, null, undefined, array, or obj)? "},"comment":{"url":"https://api.github.com/repos/mobxjs/serializr/issues/comments/364476738","html_url":"https://github.com/mobxjs/serializr/issues/74#issuecomment-364476738","issue_url":"https://api.github.com/repos/mobxjs/serializr/issues/74","id":364476738,"user":{"login":"AndrewMorsillo","id":858965,"avatar_url":"https://avatars3.githubusercontent.com/u/858965?v=4","gravatar_id":"","url":"https://api.github.com/users/AndrewMorsillo","html_url":"https://github.com/AndrewMorsillo","followers_url":"https://api.github.com/users/AndrewMorsillo/followers","following_url":"https://api.github.com/users/AndrewMorsillo/following{/other_user}","gists_url":"https://api.github.com/users/AndrewMorsillo/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewMorsillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewMorsillo/subscriptions","organizations_url":"https://api.github.com/users/AndrewMorsillo/orgs","repos_url":"https://api.github.com/users/AndrewMorsillo/repos","events_url":"https://api.github.com/users/AndrewMorsillo/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewMorsillo/received_events","type":"User","site_admin":false},"created_at":"2018-02-09T16:05:28Z","updated_at":"2018-02-09T16:05:28Z","author_association":"NONE","body":"Should something like this work?\r\n\r\n```\r\nexport function anyType() {\r\n    return {\r\n        serializer: (v,k,obj) => EJSON.stringify(v),\r\n        deserializer: (val, context) => EJSON.parse(val)\r\n    }\r\n}\r\n\r\nclass MyClass{\r\n    @serializable(anyType()) @observable myAnyType: any\r\n}\r\n```"}}
{"actor":{"display_login":"AndrewMorsillo"}}