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
2
votes
0 answers

QJsonObject chained assignment produces unexpected results

When I assign the same value to two different non-existent keys in QJsonObject, I'm getting an unexpected result: json["first"] = json["second"] = "world!"; As far as I know, this code should add two new keys first and second, both with a value of…
rafalk42
  • 21
  • 2
2
votes
0 answers

How to recursive create QJsonObject's without copies

Might relate to How to change QJsonObject value in a QJson hierarchy without using copies?, but the answer is basically, it doesn't work, maybe things have changed since then. Given is the following signature: void addToJson(const QStringList& path,…
user1347198
2
votes
1 answer

append QJsonObjects in a QJsonArray

I am trying to create a json file in which i insert QjsonObjects in an only one QJsonArray,what i get is every QjsonObject is in an independent QJsonArray but i want them to be in the same array. this function is called every time a save button is…
user user
  • 47
  • 1
  • 7
2
votes
1 answer

QJsonDocument::array() and QJsonDocument::object()

I am reading the QJsonDocument documentation and I use QJsonDocument with following line: emit this->ueSignalNewDataArrivedPlaces(QJsonDocument::fromBinaryData(incomingData[0].toByteArray())); and I do not understand, after this line, should I use …
KernelPanic
  • 2,328
  • 7
  • 47
  • 90
2
votes
1 answer

QJSON using in Mac - getting some issues

I am using the QJson for parsing. But I am stuck up with some issues. I have used the following code: void CityBook ::getCityList(QUrl url) { //!connect(cityReply, SIGNAL(readyRead()),this, SLOT(httpReadyRead())); …
Finder
  • 8,259
  • 8
  • 39
  • 54
2
votes
1 answer

How to generate JsonRpc request in qt?

I want to generate a qjsonstring in this format: {"id": 1, "params":{"parameter1": 1, "parameter2": 2}} But I don't know how to add parameter1 parameter2 to key params This is my code: QJsonObject *jsonObj = new QJsonObject();…
newww0
  • 181
  • 3
  • 12
2
votes
1 answer

QJsonDocument - getting values indented

I have a Json response like this: { "data": [ { "id": "someID", "participants": { "data": [ { "id": "idN1" }, { "id": "idN2" } ] } }, …
MuGiK
  • 351
  • 4
  • 13
2
votes
2 answers

How To Use QJson library In Qt

Now i am using Qt v2.3 I have one problem, i need to send the data to server by using json but Qjson class is not there. How to include JSON to Qt? or Is there any external header file for that?
user3472783
  • 743
  • 1
  • 6
  • 7
2
votes
2 answers

Qjson get object name

I have a json object how can I get object name ? I can't have object name it will be sent by server and that way I should get the object names. { "success":1, "return":{ "343152":{//get this object name "pair":"usd_eur", …
2
votes
2 answers

Using QJson library in Qt Creator under Ubuntu

I'm trying to use the QJson library in an application that is being created in Qt Creator . The operating sytsem is Ubuntu 12.04 32-bit. I used synaptic to install libqjson0 (0.7.1-6). The libary was installed in…
DarwinIcesurfer
  • 1,073
  • 4
  • 25
  • 42
2
votes
0 answers

Having a issue accessing/loading QJSon dylib at runtime on Mac OS X

I compiled the QJSon code from the command line and it generated a dylib (libqjson.0.7.1.dylib) I then added this file as an external dependency to one of the libraries in my app. (using Xcode 4.3 as the IDE) everything seems to compile correctly.…
TwoGunBerg
  • 31
  • 3
1
vote
1 answer

How to build QJson under Windows for use with QtCreator?

I would like to know how to build QJson under Windows. I've downloaded sources, but I have no idea how to proceed with it. There are multiple instructions how to add a DLL from QJson, but how to I get the library file?
krltos
  • 313
  • 4
  • 20
1
vote
1 answer

Cannot convert std::string to QJsonArray in Qt

The following text is a bit of std::string text that is generated by another app (I do not have control of what the app sends me). I have tried for days to get this converted into a QJsonArray and cannot figure this out. I am using C++ within QT. …
1
vote
1 answer

Yocto: CMake tries linking libraries from sysroot native

I am trying to create a Bitbake recipe for QJson (https://github.com/flavio/qjson) that should run with the embedded version of Qt4. My Bitbake recipe contains the following lines SECTION = "libs" DEPENDS = "qt4-embedded" ... license stuff…
enco
  • 11
  • 4
1
vote
1 answer

convert json array of hashes to Qt list of QHashes

I have a QString of JSON-encoded dictionaries. Is there a simple way to convert them to a list of QHashes? I've looked at this post Best JSON parser for Qt?, but haven't been able to get a valid QHash out (says it's empty). "[{ 'var' : 'xres',…
voodoogiant
  • 2,118
  • 6
  • 29
  • 49