Deserialize MsgPack with anonymous list in C++

42 Views Asked by At

Imagine a list with few structures with fields of different types

 "[{ "field1":"b"
     "field2": 7  },

   { "field1":"e",
     "field2": 8  },

   { "field1":"g",
     "field2": 3  }]"

I receive bytes serialized with MsgPack. I want to deserialize it. How can I do this?

With Qt implementation of MsgPack (QMsgPack) it is possible to use QVariantList which could contain different types inside a list and a method toList(). It would be something like this:

QVariantList list = MsgPack::unpack(receivedBytes).toList();

But i cannot use Qt libraries due to limitations of the project. How can I deserialize anonymous list of structures?

p.s. Not to mention: i cannot know the length of a incoming list.

0

There are 0 best solutions below