{"action":"opened","issue":{"url":"https://api.github.com/repos/rpgmaker/NetJSON/issues/150","repository_url":"https://api.github.com/repos/rpgmaker/NetJSON","labels_url":"https://api.github.com/repos/rpgmaker/NetJSON/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/rpgmaker/NetJSON/issues/150/comments","events_url":"https://api.github.com/repos/rpgmaker/NetJSON/issues/150/events","html_url":"https://github.com/rpgmaker/NetJSON/issues/150","id":202437724,"number":150,"title":"Byte Array serialization","user":{"login":"LorenzoRuggeri","id":20802945,"avatar_url":"https://avatars.githubusercontent.com/u/20802945?v=3","gravatar_id":"","url":"https://api.github.com/users/LorenzoRuggeri","html_url":"https://github.com/LorenzoRuggeri","followers_url":"https://api.github.com/users/LorenzoRuggeri/followers","following_url":"https://api.github.com/users/LorenzoRuggeri/following{/other_user}","gists_url":"https://api.github.com/users/LorenzoRuggeri/gists{/gist_id}","starred_url":"https://api.github.com/users/LorenzoRuggeri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LorenzoRuggeri/subscriptions","organizations_url":"https://api.github.com/users/LorenzoRuggeri/orgs","repos_url":"https://api.github.com/users/LorenzoRuggeri/repos","events_url":"https://api.github.com/users/LorenzoRuggeri/events{/privacy}","received_events_url":"https://api.github.com/users/LorenzoRuggeri/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-23T03:18:58Z","updated_at":"2017-01-23T03:18:58Z","closed_at":null,"body":"Hi rpgmaker,\r\nfirst of all thanks for your great work!\r\n\r\nI (ab)-used a lot of your work for an inter-server communication project and I appreciated it.\r\nNow I'm facing again my caching project, which I pulled out 2 years ago.\r\nUpdated libraries via NUGet and... go for benchmarking.\r\nWell, NetJSON won by a mile over Wire. :) At least on my simple DTOs. :)\r\n\r\nThe problem is when I pass an object with byte array as property. I don't catch an error until I deserialize the resulting bytes.\r\nTo do so I encapsulated the Serialize and Deserialize in those two methods (they both inherit from an interface I use on my project, which I wish to don't change):\r\n\r\n        public byte[] Serialize<T>(T value)\r\n        {\r\n            return Encoding.UTF8.GetBytes(NetJSON.NetJSON.Serialize(value.GetType(), value));\r\n        }\r\n\r\n\r\n        public T Deserialize<T>(byte[] bytes)\r\n        {\r\n            return (T)NetJSON.NetJSON.Deserialize(typeof(T), Encoding.UTF8.GetString(bytes));\r\n        }\r\n\r\nAre they correct? Would you suggest another way to serialize/deserialize an object?\r\n\r\nAre the byte arrays excluded from a re-work in NetJSON?\r\nDo I need to serialize a byte array through NetJSON.NetJSON.RegisterTypeSerializer<T> (Func <T, string> serializeFunc); ? And if yes how would you suggest it?\r\n\r\nThanks again 👍 \r\n"}}
{"actor":{"display_login":"LorenzoRuggeri"}}