Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to get indented JSON values in C++ ?
QtWS25 Last Chance

how to get indented JSON values in C++ ?

Scheduled Pinned Locked Moved Solved General and Desktop
jsonc++json parserqt application
12 Posts 7 Posters 5.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qjay
    wrote on 3 Jun 2016, 10:55 last edited by
    #3

    Thanks paul colby !! It worked out .

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      Qjay
      wrote on 4 Jun 2016, 19:13 last edited by
      #4

      i also want to get pageid and revid too .

      I tried this : but was not able to get the pageid :/

       jsonResponse.object()["parse"].toObject()["pageid"].toString();
      
      J 1 Reply Last reply 4 Jun 2016, 19:23
      0
      • Q Qjay
        4 Jun 2016, 19:13

        i also want to get pageid and revid too .

        I tried this : but was not able to get the pageid :/

         jsonResponse.object()["parse"].toObject()["pageid"].toString();
        
        J Offline
        J Offline
        Joel Bodenmann
        wrote on 4 Jun 2016, 19:23 last edited by
        #5

        The pageid value in your JSON is not a string but rather an integer, hence you have to use QJsonValue::toInt() instead of QJsonValue::toString():

        jsonResponse.object()["parse"].toObject()["pageid"].toInt();
        

        Industrial process automation software: https://simulton.com
        Embedded Graphics & GUI library: https://ugfx.io

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Anil Patel
          wrote on 8 Aug 2018, 14:45 last edited by
          #6

          Hi All,

          Need some help from you,
          How to remove "\n" between Two Json Attribute while printing .

          M G 2 Replies Last reply 8 Aug 2018, 16:08
          0
          • A Anil Patel
            8 Aug 2018, 14:45

            Hi All,

            Need some help from you,
            How to remove "\n" between Two Json Attribute while printing .

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 8 Aug 2018, 16:08 last edited by
            #7

            @Anil-Patel
            Hi
            Show how you "print" please ?

            A 1 Reply Last reply 9 Aug 2018, 07:30
            0
            • M mrjj
              8 Aug 2018, 16:08

              @Anil-Patel
              Hi
              Show how you "print" please ?

              A Offline
              A Offline
              Anil Patel
              wrote on 9 Aug 2018, 07:30 last edited by
              #8

              @mrjj {
              "app": "PromotionDngineyscad",
              "host": "WINASBAV7d7d750142-UBN",
              "log": "PromoLog",
              "lvl": "Messages",
              "msg": "Initialized",
              "thread": "237fbb2db10",
              "timestamp": "1533796312.526572",
              "uuid": "e62191c4-8891-4c92-a908-da01a3dakje3ac7ad"
              }

              J M 2 Replies Last reply 9 Aug 2018, 09:14
              0
              • A Anil Patel
                9 Aug 2018, 07:30

                @mrjj {
                "app": "PromotionDngineyscad",
                "host": "WINASBAV7d7d750142-UBN",
                "log": "PromoLog",
                "lvl": "Messages",
                "msg": "Initialized",
                "thread": "237fbb2db10",
                "timestamp": "1533796312.526572",
                "uuid": "e62191c4-8891-4c92-a908-da01a3dakje3ac7ad"
                }

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 9 Aug 2018, 09:14 last edited by
                #9

                @Anil-Patel You should reread the question from @mrjj

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • A Anil Patel
                  9 Aug 2018, 07:30

                  @mrjj {
                  "app": "PromotionDngineyscad",
                  "host": "WINASBAV7d7d750142-UBN",
                  "log": "PromoLog",
                  "lvl": "Messages",
                  "msg": "Initialized",
                  "thread": "237fbb2db10",
                  "timestamp": "1533796312.526572",
                  "uuid": "e62191c4-8891-4c92-a908-da01a3dakje3ac7ad"
                  }

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 9 Aug 2018, 09:17 last edited by mrjj 8 Sept 2018, 12:48
                  #10

                  @Anil-Patel
                  I did mean the code :)
                  if you use printf, qDebug, or what ever.

                  You could use QString's replace if the newline are truely in the the json string.

                  1 Reply Last reply
                  0
                  • A Anil Patel
                    8 Aug 2018, 14:45

                    Hi All,

                    Need some help from you,
                    How to remove "\n" between Two Json Attribute while printing .

                    G Offline
                    G Offline
                    Gojir4
                    wrote on 9 Aug 2018, 11:37 last edited by
                    #11

                    @Anil-Patel Hi,
                    Please make a new post for a new question, even more if you are not the author of the original question...

                    For your issue, I think you need to call QJsonDocument::toJson(QJsonDocument::Compact) when you export your json content to string.

                    A 1 Reply Last reply 9 Aug 2018, 12:24
                    2
                    • G Gojir4
                      9 Aug 2018, 11:37

                      @Anil-Patel Hi,
                      Please make a new post for a new question, even more if you are not the author of the original question...

                      For your issue, I think you need to call QJsonDocument::toJson(QJsonDocument::Compact) when you export your json content to string.

                      A Offline
                      A Offline
                      Anil Patel
                      wrote on 9 Aug 2018, 12:24 last edited by
                      #12

                      @Gojir4
                      Sure, Thanks for your Help.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved