So msgpack-c provides me with objects as arrays. Say I serialized a a C++ message alike this:
template <class T>
struct Message {
std::vector<T> data;
std::vector<int> shape;
MSGPACK_DEFINE(data, shape);
};
and had T == double.
If deserialised to json in C++ it would have internals like [[1.23,3.01,44.02,33],[2,2]].
Now I want to deserialize it in C# with MessagePack-CSharp. If I try to turn it into json string I get an empty string, when I try
var msg = MessagePackSerializer.Deserialize<List<List<double>>>(e.RawData);
I get
System.InvalidOperationException: code is invalid. code:0 format:positive fixint at MessagePack.Decoders.InvalidArrayHeader.Read (System.Byte[] bytes, Int32 offset, System.Int32& readSize) [0x0001b] in MessagePack/MessagePackBinary.cs:3543
same happens when I try:
[MessagePackObject]
public class Msg {
[Key(0)]
public List<double> data;
[Key(1)]
public List<int> shape;
}
So how to deserialize [[doubles], [ints]] array in C# MessagePack-CSharp?
برچسب:
نویسنده: استخدام کار