0

I have struct type:

struct Book 
{
   int id;
   QString name;
   QString author;
}

And I read these from JSON text, and store them to QVector<Book> container.

How to convert this vector back to JSON text?

hyde
  • 60,639
  • 21
  • 115
  • 176

1 Answers1

0

JSON is supported by Qt 5, look at JSON Support in Qt

bruno
  • 32,421
  • 7
  • 25
  • 37
  • Yes, i know about it. I use it for convert string into Book type, but i did not find how to convert my container with objects to json. Especially, i want to know best practices with converting to json in qt. – Bogdan Babitskiy Jan 08 '19 at 17:19
  • @BogdanBabitskiy there is an example : _The JSON Save Game example demonstrates how to save and load a small game using QJsonDocument, QJsonObject and QJsonArray._ THis is all you need – bruno Jan 08 '19 at 17:21
  • oh, i forgot about the example) – Bogdan Babitskiy Jan 08 '19 at 17:24