Problem with unpack array packed with python server
hi I pack object like {"name":"test","sessions":["xxxxx","yyyyy"]} with message pack in python but when i unpack this object to object with your client get an object like {"name":"test","sessions":2} (it's give me number of item in array) i test with both unpack method and unpacksingleobject method but result is same can you help me please?
Hi, do you say that you used Unpacker directly instead of MessagePackSerializer? If so, it is by design. An Unpacker returns a count of collection at first, then returns items in order. However, UnpackSingleObject should returns with unpacked nested arrays/maps, so it looks a bug.
I recommend you to use MessagePackSerializer if you can use it.
Hi Thanks for Reply i use code like this
private T DecodeData<T>(byte[] data) where T : class { var serializer = SerializationContext.Default.GetSerializer<T>(); Stream stream = new MemoryStream(data); var result = serializer.Unpack(stream); return result; }
Should i use MessagePackSerializer instead of SerializationContext.Default.GetSerializer<T>(); ?
Thank you for reply. In your code, var serializer should be MessagePackSerializer<T>. So, could you also show me additional information? Specifically, the actual T when you face the problem, and the desereializing binary (in hex string, such as result of BitConverter.ToString).