Questions tagged [qjson]

QJson is a qt-based library that maps JSON data to QVariant objects: JSON arrays will be mapped to QVariantList instances, while JSON objects will be mapped to QVariantMap.

QJson is a small and easy-to-use library. Converting a JSON object is as simple as this:

// create a JSonDriver instance
QJson::Parser parser;
bool ok;

// json is a QString containing the data to convert
QVariant result = parser.parse (json, &ok);

Official page | API documentation

85 questions
33
votes
6 answers

easiest way to parse JSON in Qt 4.7

I need to parse JSON object through Qt. What is the easiest/fastest way to do it?
wael34218
  • 4,860
  • 8
  • 44
  • 62
22
votes
3 answers

How to change QJsonObject value in a QJson hierarchy without using copies?

I am currently using Qt5.0 with the core QJson library to handle some data for the program I am developing. To set the scene for this question I will provide you with some JSON data that illustrates my problem: { "CLOCKS": [ { …
user2472658
  • 223
  • 1
  • 2
  • 5
14
votes
3 answers

How to serialize to JSON in Qt

How can I JSON serialize a QVariant (or other type of data) in Qt. I don't want to use an external third party library like QJson
user457015
  • 960
  • 4
  • 14
  • 33
9
votes
4 answers

JSON in Qt using QVariantMap

I would like to parse this JSON output in a symbian application: [ {"ID":"9","titel":"wouter","plaatsID":"2616","prio":"3"}, {"ID":"8","titel":"pasta","plaatsID":"3780","prio":"3"}, {"ID":"6","titel":"Muts…
Wouter van Reeven
  • 517
  • 3
  • 8
  • 16
9
votes
1 answer

Save UI settings with QSettings or QJson?

Saving UI settings with QSettings is cumbersome and buggy, because each time you must use setValue() and value() functions and also define groups, application name and organization which can be buggy in large applications: QSettings…
abdolahS
  • 663
  • 12
  • 35
5
votes
2 answers

gcc -I and -L options don't seem to work

I am trying to compile a project in my system using qmake. Some dependencies of the project are not installed but reside in my home directory, more or less like this: libs files: /home/myusername/local/lib and my includes directory…
Sambatyon
  • 3,316
  • 10
  • 48
  • 65
4
votes
1 answer

How to register the following datatype to allow serialization?

I am using QJson to serialize a QObject-derived class. I am able to serialize the class itself without any problems, but when it comes to one of its members, I am having a bit of trouble. The class is named CProject and it contains a property files…
Nathan Osman
  • 71,149
  • 71
  • 256
  • 361
4
votes
2 answers

Qt5 JSON parsing from QByteArray

I have QByteArray,contains this JSON {"response": {"count":2, "items":[ {"name":"somename","key":1"}, {"name":"somename","key":1"} ]}} Need to parse and get the required data: QJsonDocument itemDoc =…
4
votes
1 answer

QJsonDocument::toJson() generates extra large text. Is there way to fix it?

I have made class that convert QList (very big list) to JSON string, but it generates a extra large text. Here is code: QJsonObject…
IGHOR
  • 691
  • 6
  • 22
3
votes
1 answer

Fastest way to convert Vector to QJsonArray?

Currently, I am iterating through a vector in order to convert it to a QJsonArray: QJsonArray toJson(const std::vector& myVec) { QJsonArray result; for(auto i = myVec.begin(); i != myVec.end(); i++) { …
Griffort
  • 1,174
  • 1
  • 10
  • 26
3
votes
2 answers

How to convert QVariant to QJsonValue?

How to convert QVariant to QJsonValue? I know QVariant provide the toJsonValue function, but it did not perform as expected. For example: qDebug()<
JustWe
  • 4,250
  • 3
  • 39
  • 90
3
votes
1 answer

QVariantMap Json Parsing in QT

I am using the following code for parsing: QJson::Parser parser; bool ok; QVariantMap result=parser.parse (cityReply->readAll(),&ok).toMap(); if (!ok) { qFatal("An error occurred during parsing"); exit (1); } foreach (QVariant city,…
Finder
  • 8,259
  • 8
  • 39
  • 54
3
votes
1 answer

Install QJson in Mac

How to install the Qjson in mac?
Finder
  • 8,259
  • 8
  • 39
  • 54
3
votes
1 answer

Qt and JSON resource parsing - Empty QJSONDocument

I've got a trouble while parsing JSON using QJON objects. I read a json file of mine referenced in a resource file, read the content and try to initialize a QJSONDocument from the QString I got. And it seems it's not working Here is the code I use :…
Marc Delerue
  • 65
  • 10
3
votes
1 answer

Undefined reference to QJson::Parser::Parser

I've successfully(?) installed the QJson library following the instructions in the archive. But the compiler gives me this error: Undefined reference to QJSon::Parser::Parser(). I've found where library files have been installed: it's…
Ivan Akulov
  • 4,323
  • 5
  • 37
  • 64
1
2 3 4 5 6