Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. json
    Log in to post

    • UNSOLVED how can i modify the value of the Qjason array?
      General and Desktop • json qjsonarray • • CupofCoffee  

      4
      0
      Votes
      4
      Posts
      43
      Views

      @CupofCoffee said in how can i modify the value of the Qjason array?: TradingAreaInfoArr = rootObj["TradingAreaInfo"].toArray(); My understanding is that this returns a copy of the QJsonArray. You can modify that copy (update values, append new ones), but that does not alter the array in the QJsonDocument. The same with the QJsonObject InfoObj = rootObj["info"].toObject(); The objects/arrays in these are read-only. You have to copy them out as above, alter them, and then replace the current objects/arrays in the document, or create a new one, in order to produce a new document with the updates which can be saved.
    • UNSOLVED Write in JSON file - Data not inserted in the correct order
      General and Desktop • c++ json qjsonobject • • HW-Developer  

      14
      0
      Votes
      14
      Posts
      311
      Views

      I did resolve it using rapidjson instead of QJsonObject Thank you all
    • UNSOLVED Access json metadata from the plugin itself.
      General and Desktop • plugin json metadata qpluginloader qplugin • • Petross404_Petros S  

      1
      0
      Votes
      1
      Posts
      191
      Views

      No one has replied

    • UNSOLVED How to exploit a json file in QT ?
      General and Desktop • json cpp • • feedain  

      28
      0
      Votes
      28
      Posts
      790
      Views

      @jsulm said in How to exploit a json file in QT ?: @feedain You already have this code snippet here, did you notice it? obj["State"] = int(state); yes thanks
    • SOLVED Reach the spesific element of Json Array
      General and Desktop • qt5 json • • deleted286  

      13
      0
      Votes
      13
      Posts
      335
      Views

      @JonB I produced my Json. It make sense i will edit my json and write without " "
    • SOLVED Replace and Remove from html string not working
      General and Desktop • qstring json html • • RekTekk249  

      5
      0
      Votes
      5
      Posts
      284
      Views

      @JKSH Oh wow, you're completely right. I didn't know qDebug() behaved like this, I assumed noquote() was the default. Thanks for the help, I don't know how long it would have taken me to find out.
    • SOLVED write to a different file each time of run
      General and Desktop • qt5 json write • • deleted286  

      7
      0
      Votes
      7
      Posts
      372
      Views

      @J-Hilk thank you
    • SOLVED Read from Json in an order
      General and Desktop • qt5 json jsonparser • • deleted286  

      9
      0
      Votes
      9
      Posts
      355
      Views

      @jsulm thank you. I did it with your solution. It works fine.
    • SOLVED How to parse such a complex json file
      General and Desktop • qt5 json read • • deleted286  

      10
      0
      Votes
      10
      Posts
      546
      Views

      @suslucoder The "Plan" array is a little unusual because the objects it contains are not all of the same structure. Usually, arrays should contain a sequence of elements of the same type. However, it is legal JSON. If you are certain that the first element of the "Plan" array will have the structure as in your example above, you can perhaps rely on the others to all have the 2nd type structure. Otherwise, you might need to check for the existence of certain keys -- for example, by using the function QJsonObject::contains() to determine which kind of object it is.
    • UNSOLVED Creating json file with subroot
      General and Desktop • qt5 json root • • deleted286  

      13
      0
      Votes
      13
      Posts
      325
      Views

      @KroMignon thank you
    • SOLVED no member named 'write' in 'QString'
      General and Desktop • qt5 json write • • deleted286  

      9
      0
      Votes
      9
      Posts
      679
      Views

      @suslucoder said in no member named 'write' in 'QString': Im on ubuntu :) Oh, OK, then it doesn't actually matter as there is no "text vs binary" mode/format under Linux! Nonetheless I think it's good practice to put QIODevice::Text in, just in case you ever port to Windows...
    • UNSOLVED Storing real time datas as a JSON File
      General and Desktop • qt5 json real time • • deleted286  

      6
      0
      Votes
      6
      Posts
      191
      Views

      @suslucoder This is contrary to 'real-time'.
    • SOLVED Creating a JSON file
      General and Desktop • qt5 json write • • deleted286  

      7
      0
      Votes
      7
      Posts
      520
      Views

      @KroMignon thank you
    • UNSOLVED Error when reading Json File
      General and Desktop • qt5 json jsonparser • • deleted286  

      10
      -1
      Votes
      10
      Posts
      627
      Views

      @Christian-Ehrlicher I did use it. It looks in a code tag in my screen.
    • UNSOLVED How can I create our configuration file?
      General and Desktop • qt5 json config file • • deleted286  

      19
      0
      Votes
      19
      Posts
      1007
      Views

      @jsulm Ok. Thank you for your answers.
    • UNSOLVED Create QByteArray JSON with special characters (é, ...) as unicode (\uxxxx)
      General and Desktop • json json parser encoding unicode • • Mixlu  

      4
      0
      Votes
      4
      Posts
      460
      Views

      @Mixlu What do you mean by "Unicode escaped format"? Normal characters won't be escaped, even a character like é also doesn't need to be escaped. If you use some special characters like \0, then it will be escaped to\u0000
    • UNSOLVED Consistency between null QJsonValue and QVariant
      General and Desktop • json qvariant • • Moia  

      5
      0
      Votes
      5
      Posts
      179
      Views

      Maybe @Moia want a method to get that QVariant without a QJsonValue? By looking into the source code of QJsonValue, you can see that value comes from QVariant::fromValue(nullptr)
    • UNSOLVED sending Json to local Ip
      QML and Qt Quick • json https post local ip • • Mahdi  

      2
      0
      Votes
      2
      Posts
      144
      Views

      Hi, From the looks of it, you are looking for the XMLHttpRequest example.
    • UNSOLVED extract values from json result
      General and Desktop • json json parser • • Qjay  

      5
      0
      Votes
      5
      Posts
      437
      Views

      well this is how i have done it. Not sure if this is even the right way ( looks like a mess to me) QJsonDocument doc = QJsonDocument::fromJson(result.toUtf8()); qDebug() << "doc :" << doc; QJsonObject doc_obj = doc.object(); qDebug() << "doc_obj :" << doc_obj; QJsonArray doc_array = doc_obj.value("results").toArray(); doc_obj = doc_array[0].toObject(); doc_array = doc_obj.value("series").toArray(); doc_obj = doc_array[0].toObject(); doc_array = doc_obj.value("values").toArray(); for(int i = 0; i < doc_array.size(); i++) { QJsonArray arr = doc_array[i].toArray(); qDebug() << "doc value : " << arr[1].toString(); } i am getting resuls though
    • UNSOLVED How I can create Json Format in Qt ?
      General and Desktop • json qjsondocument • • npatil15  

      7
      0
      Votes
      7
      Posts
      892
      Views

      @mrjj said in How I can create Json Format in Qt ?: someObj Thanks, it helps a lot.
    • SOLVED Strange Json issue, conversion from QByteArray to QJsonDocument not working as intended
      General and Desktop • qtcreator json installation bytearray • • DanBar  

      16
      0
      Votes
      16
      Posts
      4164
      Views

      @jsulm we make an installation file for our combined system, including multiple programs sharing some but not other resources. we use an nsi script to manage this. usually works fine. I just missed updating some of the .dll files.
    • SOLVED Change a QJsonObject into an integer
      General and Desktop • gui json qjsonobject change integers • • hoonara  

      10
      0
      Votes
      10
      Posts
      3774
      Views

      @Christian-Ehrlicher ahh, you are right. Good catch. http://doc.qt.io/qt-5/qjsonvalue.html#toDouble converts the QJsonValue to double if its that type(). in this case it will return defaultValue (0) so its something like QJsonValue bid1 = jsonObj.value("bid_1"); QString asStr=bid1.toString(); double n = asStr.toDouble(); qDebug() << n;
    • SOLVED How to get a Json value from an api and display it in a GUI
      General and Desktop • c++ json qnetworkrequest api qurl • • hoonara  

      8
      0
      Votes
      8
      Posts
      4953
      Views

      @Lodhi-bhkr Sorry, but this is not a question. What did you try? What problems do you have? Please ask more specific questions. Looks like you asked here already: https://forum.qt.io/topic/120439/qt-code-to-send-data-on-postman-http-post-request
    • UNSOLVED How should i store the results ??
      General and Desktop • qtcreator qt5 json qbytearray json parser • • Qjay  

      6
      0
      Votes
      6
      Posts
      942
      Views

      @Paul-Colby Thanks i myself did something like this :) QVariantMap json_map; const QJsonDocument doc = QJsonDocument::fromJson(output); qDebug().noquote() << doc; qDebug().noquote() << doc.array(); foreach (auto value, doc.array()) { qDebug().noquote() << value; qDebug().noquote() << value.toObject(); qDebug().noquote() << value.toObject().value("name"); json_map["name"] = value.toObject().value("name").toString(); json_map["installed"] = value.toObject().value("installed").toBool(); json_map["id"] = value.toObject().value("id").toString(); json_map["filename"] = value.toObject().value("filename").toString(); }
    • UNSOLVED How to create a web service and send Json to this?
      General and Desktop • sqlite json http web service web server • • Saman19  

      2
      0
      Votes
      2
      Posts
      497
      Views

      @Saman19 You may want to check out Cutelyst if you want to support the HTTP protocol. If you do not need to rely on HTTP, but just want to receive JSON (or any custom protocol), take a look at QTcpServer examples.
    • SOLVED Key type of QJsonObject
      General and Desktop • json json parser qjsonobject • • tansgumus  

      5
      0
      Votes
      5
      Posts
      4397
      Views

      Thank you guys. What a wonderful quick responses.
    • UNSOLVED JSON with multi tasking
      Mobile and Embedded • json java websocket embedded qt qt c++ • • A Former User  

      8
      0
      Votes
      8
      Posts
      1972
      Views

      Hi @Geeva, @Geeva said in JSON with multi tasking: @JKSH Thanks for solving basic confusion. I have one more doubt also. Here, I have attached program for verification. I hope you can provide a proper solution You're welcome. I'm happy to teach you basics. However, verifying your program is too difficult to do on a forum. You need to do 2 things: Take C++ lessons Practice writing and debugging simple programs for your hardware
    • UNSOLVED QJsonValue decimal number
      General and Desktop • json qjsonvalue qdecimal • • debegr  

      8
      0
      Votes
      8
      Posts
      3812
      Views

      Hi @SGaist , no sorry. This was my first try to solve this. It dosn't work because of: @JNBarchan said: Once JSON has taken it as a double, it's too late. With a small test program I testes Qt-JSON: https://github.com/qt-json/qt-json #include <QCoreApplication> #include <QDebug> #include "json.h" int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QString json = "{\"success\":true,\"message\":\"some-message\",\"number1\":1.234,\"number2\":\"5.678\"}"; bool ok; QtJson::JsonObject result = QtJson::parse(json, ok).toMap(); qDebug() << "number1: " << result["number1"].toString(); qDebug() << "number2: " << result["number2"].toString(); return a.exec(); } Which gives me the following output: number1: "1.234" number2: "5.678" So I think I can work with this library, but a bit sad about the truth, that such a case can't be handled without external libraries.
    • SOLVED Parsing JSON in QML
      QML and Qt Quick • json json parser parsing • • Stefan Monov76  

      3
      0
      Votes
      3
      Posts
      2019
      Views

      @Wieland: Thanks!
    • UNSOLVED Storing a JSON object
      QML and Qt Quick • json • • Sikarjan  

      11
      0
      Votes
      11
      Posts
      4421
      Views

      Thanks again for the explanation. I wish I had more time to learn programming correctly...
    • UNSOLVED Parsing JSON with QML
      QML and Qt Quick • json • • Sikarjan  

      3
      0
      Votes
      3
      Posts
      3904
      Views

      Hi, I am using the one dridk mentioned. The parsing works fine and I use listModel.append({jsonObject}); to fill my ListView. Everything is in the ListModel besides z. If I do: for(var i in jsonObject){ eventModel.append(jsonObject[i]) eventModel.set(i, {"zn":jsonObject[i]["z"][0]}) } z is added as an array. Just like in the JSON object just without the []-brackets.
    • UNSOLVED How to I prepare models for Canvas3D view?
      QML and Qt Quick • json 3d canvas mesh • • Aras  

      2
      0
      Votes
      2
      Posts
      876
      Views

      Try to triangulate faces of your mesh (select your shape, switch to Edit Mode and press Ctrl+T ).
    • SOLVED can't get JSON file from QNetworkReply
      General and Desktop • json qnetworkaccessm qwebengineview qnetworkrequest qnetreply • • nazimGT  

      2
      0
      Votes
      2
      Posts
      4563
      Views

      resolved !! i've chenged m_pNetworkAccessManager->get(request); by request.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); QByteArray par=""; m_pNetworkAccessManager->post(request,par);
    • Process returned JSON in webview
      General and Desktop • qml qt quick json webview • • Qjay  

      4
      0
      Votes
      4
      Posts
      1663
      Views

      In answer to my original question i did something like this onUrlChanged: { console.log(searchwebview.url); test_json(); } and i made this function to parse the returned JSON ( this function is not perfect yet ) function test_json() { var p_url = searchwebview.url var http = new XMLHttpRequest(); var json , parse , text , rev_id; http.onreadystatechange = function(){ if(http.readyState == 4 && http.status == 200) { json = http.responseText; parse = JSON.parse(json); rev_id = parse.parse.revid; console.log(rev_id); text = parse.parse.text["*"]; //console.log(text); // <-- STRIP ME (o.O) while(text.match(/&#39;\/index.php/)){ text = text.replace(/&#39;\/index.php/, "http://en.wikitolearn.org/index.php"); text = text.replace(/&amp;/,"&"); text = text.replace(/MathShowImage&amp;/, "MathShowImage&") text = text.replace(/mode=mathml&#39;/, "mode=mathml\""); text = text.replace(/<meta class="mwe-math-fallback-image-inline" aria-hidden="true" style="background-image: url\(/ ,"<img style=\"background-repeat: no-repeat; background-size: 100% 100%; vertical-align: -0.838ex;height: 2.843ex; \" src=\""); text = text.replace(/<meta class="mwe-math-fallback-image-display" aria-hidden="true" style="background-image: url\(/ ,"<img style=\"background-repeat: no-repeat; background-size: 100% 100%; vertical-align: -0.838ex;height: 2.843ex; \" src=\""); text = text.replace(/&amp;mode=mathml\"/ , "&mode=mathml>\""); text = styling + text; } console.log(text); // after strip :p . webview.loadHtml(text); } }; http.open('GET',p_url); http.send(); }
    • SOLVED How to access this JSON ( indented JSON )
      General and Desktop • json • • Qjay  

      9
      0
      Votes
      9
      Posts
      2368
      Views

      Crap i mixed 2 codes. Sorry for that :m. Thank you everyone
    • SOLVED how to get indented JSON values in C++ ?
      General and Desktop • c++ json qt application json parser • • Qjay  

      12
      0
      Votes
      12
      Posts
      4168
      Views

      @Gojir4 Sure, Thanks for your Help.