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
0
votes
1 answer

Double to QString and save in QJsonDocument

I need to save values ​​below pre-set levels, using QJsonDocument. I have the following example of code: (...) gameLevels= {3.67, 7.43, 9.76}; while(gameLevels[i] <= x) { for(...) { //do something and calculate auxPoints. } …
jonas345
  • 71
  • 7
0
votes
1 answer

Accessing combo box data model

I'm sending a QJsonArray from C++ to QML combo box: netlib.h void discoveryResultChanged(const QJsonArray jsonArray); netlib.cpp QByteArray answer_ba = reply->readAll(); QJsonDocument answer_json_doc =…
Megidd
  • 7,089
  • 6
  • 65
  • 142
0
votes
1 answer

How to modify QJsonObject

I can set values to objects this way in the simple json-file. Qt code: if(file.open(QIODevice::ReadOnly)){ QJsonDocument doc = QJsonDocument::fromJson(file.readAll()); QJsonObject obj = doc.object(); obj["gender"] = "female"; …
Lauri
  • 137
  • 1
  • 2
  • 8
0
votes
1 answer

QJsonDocument giving null when converting from Qvariant?

#include "QtCore" #include "QMap" #include "qdebug.h" #include "qjsondocument.h" class cclass{ public: int var; }; Q_DECLARE_METATYPE(cclass); int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); cclass…
0
votes
2 answers

Construct QString from QJsonArray in Qt

While trying to construct a QString from values from a QJsonArray, I get the following error: error: passing 'const QString' as 'this' argument discards qualifiers [-fpermissive]. Dunno where I am getting it wrong in this code: QString…
Dut
  • 39
  • 8
0
votes
2 answers

Cannot convert 'QJsonObject' to 'int' in return

So I have: QJsonArray nodeCollection; nodeCollection.push_back(ListElements(program, "title", "lang")); And my ListElements method declares QJsonObject, fills it with things that I need, and should return the object so that it can be pushed to…
Romy
  • 407
  • 6
  • 25
0
votes
1 answer

install QJson in windows - 7

I want to install the qjson in my windows machine. I installed the cmake and nokia qt sdk in my window 7 and use the following commands but I am getting the error.. C:\Program Files\qjson\build>cmake -G "MinGW Makefiles" .. 'cmake' is not recognized…
Finder
  • 8,259
  • 8
  • 39
  • 54
0
votes
2 answers

jQuery: How do I make the selectall work for checkboxes

I have the following code which returns the values for checkboxes How do I select/unselect all and get all the selected values?

user244394
  • 13,168
  • 24
  • 81
  • 138
0
votes
1 answer

Qt - undefined reference to QJsonValue::toString

I'm trying to build a sample project using Qt 5.7 over Linux. Previously, the same project have been built with Qt 5.4.2 without issues. When I try with Qt 5.7, I get the followings errors: undefined reference to `QJsonValue::toString() const' I…
Juan Garcia
  • 843
  • 2
  • 11
  • 34
0
votes
1 answer

Programmaticaly updating subclassed QAbstractTableModel model and refreshing subclassed QTableView

I have subclassed QAbstractTableModel with QJsonDocument as data source. Here is header file: #ifndef UEJSONPLACESTABLEMODEL_H #define UEJSONPLACESTABLEMODEL_H #include #include #include #include…
KernelPanic
  • 2,328
  • 7
  • 47
  • 90
0
votes
2 answers

Undefined reference to a local class

I've just played with qjson library and got "undefined reference" error. This is the code: #include #include class Person: public QObject { Q_OBJECT Q_PROPERTY(QString name READ name WRITE…
dancingrobot84
  • 113
  • 2
  • 8
0
votes
1 answer

QJsonDocument parsing broken since Qt 5.4 on OSX?

I have problems parsing json since I upgraded to Qt 5.4. Here is an example: #include #include #include #include #include int main(int argc, char *argv[]) { …
RGPaul
  • 401
  • 1
  • 4
  • 11
0
votes
1 answer

QJson for Linux - Unsure How to Use QJSON Correctly

Some Background Originally made a project on mac, now I want to use my Linux machine for the same project. The settings folder relied on: #include #include #include #include These weren't…
fiz
  • 906
  • 3
  • 14
  • 38
0
votes
3 answers

Parsing data using QJson on mac

I am working on Qt project. I have installed QJson successfully. And have used parser to parse the data.My code get compiled successfully but at run time it is giving me following error: dyld: Library not loaded: libqjson.0.dylib Referenced from:…
0
votes
1 answer

Qjson handling an returned array of ojbects

I'm using Qjson to parse a json object that is returned from a web service. I'm stuck on handling an array of complex ojects. At the first level the web service returns a map consisting of "error", "id", and "return". If there are no errors I can…
DarwinIcesurfer
  • 1,073
  • 4
  • 25
  • 42