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. Strange Json issue, conversion from QByteArray to QJsonDocument not working as intended

Strange Json issue, conversion from QByteArray to QJsonDocument not working as intended

Scheduled Pinned Locked Moved Solved General and Desktop
jsonqtcreatorinstallationbytearray
16 Posts 5 Posters 5.7k 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.
  • D DanBar
    6 Aug 2018, 09:59

    @raven-worx I get the following:

    "Json error: illegal number"

    what does that mean?

    J Offline
    J Offline
    jsulm
    Lifetime Qt Champion
    wrote on 6 Aug 2018, 10:26 last edited by jsulm 8 Jun 2018, 10:26
    #6

    @DanBar Can you show the JSON string you get?

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

    1 Reply Last reply
    0
    • D DanBar
      6 Aug 2018, 09:59

      @raven-worx I get the following:

      "Json error: illegal number"

      what does that mean?

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 6 Aug 2018, 10:51 last edited by raven-worx 8 Jun 2018, 10:53
      #7

      @DanBar said in Strange Json issue, conversion from QByteArray to QJsonDocument not working as intended:

      "Json error: illegal number"
      what does that mean?

      possibly an integer/decimal value beginning with 0 (e.g. propertyName: 01234)? unless it's an octal value.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      D 1 Reply Last reply 6 Aug 2018, 15:09
      0
      • R raven-worx
        6 Aug 2018, 10:51

        @DanBar said in Strange Json issue, conversion from QByteArray to QJsonDocument not working as intended:

        "Json error: illegal number"
        what does that mean?

        possibly an integer/decimal value beginning with 0 (e.g. propertyName: 01234)? unless it's an octal value.

        D Offline
        D Offline
        DanBar
        wrote on 6 Aug 2018, 15:09 last edited by
        #8

        @raven-worx There are many values that are 0 and a few values that are decimal, are those allowed while running in Qtcreator but not as an installed program?

        a sample part of the json:
        "name": "Test 4",
        "valueA": 180,
        "valueB": "",
        "valueC": 9,
        "valueD": 1,
        "valueE": 0.8869204367,
        "valueF": 1500,
        "valueG": "C",
        "valueH": 0,
        "valueI": "16d29c44-3d0941",
        "valueJ": "1392fa45-68c943",
        "valueK": "2018-08-06 09:07:29",

        M R 2 Replies Last reply 6 Aug 2018, 15:30
        0
        • D DanBar
          6 Aug 2018, 15:09

          @raven-worx There are many values that are 0 and a few values that are decimal, are those allowed while running in Qtcreator but not as an installed program?

          a sample part of the json:
          "name": "Test 4",
          "valueA": 180,
          "valueB": "",
          "valueC": 9,
          "valueD": 1,
          "valueE": 0.8869204367,
          "valueF": 1500,
          "valueG": "C",
          "valueH": 0,
          "valueI": "16d29c44-3d0941",
          "valueJ": "1392fa45-68c943",
          "valueK": "2018-08-06 09:07:29",

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 6 Aug 2018, 15:30 last edited by
          #9

          @DanBar
          Hi
          You you also output
          http://doc.qt.io/qt-5/qjsonparseerror.html#offset-var
          as it gives a clue where in the file it gets error.

          1 Reply Last reply
          0
          • D DanBar
            6 Aug 2018, 15:09

            @raven-worx There are many values that are 0 and a few values that are decimal, are those allowed while running in Qtcreator but not as an installed program?

            a sample part of the json:
            "name": "Test 4",
            "valueA": 180,
            "valueB": "",
            "valueC": 9,
            "valueD": 1,
            "valueE": 0.8869204367,
            "valueF": 1500,
            "valueG": "C",
            "valueH": 0,
            "valueI": "16d29c44-3d0941",
            "valueJ": "1392fa45-68c943",
            "valueK": "2018-08-06 09:07:29",

            R Offline
            R Offline
            raven-worx
            Moderators
            wrote on 6 Aug 2018, 19:55 last edited by raven-worx 8 Jun 2018, 20:01
            #10

            @DanBar said in Strange Json issue, conversion from QByteArray to QJsonDocument not working as intended:

            There are many values that are 0 and a few values that are decimal, are those allowed while running in Qtcreator but not as an installed program?
            a sample part of the json:
            "name": "Test 4",
            "valueA": 180,
            "valueB": "",
            "valueC": 9,
            "valueD": 1,
            "valueE": 0.8869204367,
            "valueF": 1500,
            "valueG": "C",
            "valueH": 0,
            "valueI": "16d29c44-3d0941",
            "valueJ": "1392fa45-68c943",
            "valueK": "2018-08-06 09:07:29",

            none of those values should raise this error as far i see.
            I was talking about decimals bigger than 0. So 0 is of course a valid decimal value, but 02934 not

            But you havent answered my first question. Are you sure you already received the full data before you start to parse the JSON data?!

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 6 Aug 2018, 19:59 last edited by
              #11

              Hi,

              How long is the long array that makes things fail ?

              See QTBUG-47629 for a limitation on QJsonObject's size.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • D Offline
                D Offline
                DanBar
                wrote on 7 Aug 2018, 06:17 last edited by
                #12

                Thank you all for your help!

                I was able to solve this issue, but the problem wasn't in the Json itself. I got a tip a tip from my colleague to check the .dll-files in the installation folder, and I noticed that they weren't entirely up to date. When I replaced them with the correct version of .dll-files the issue was solved. I still don't know exactly what caused this issue between the versions (version 5.9 and 5.10) but the issue is solved so I'm happy in either case.

                Again, thanks!

                J 1 Reply Last reply 7 Aug 2018, 07:30
                1
                • D DanBar
                  7 Aug 2018, 06:17

                  Thank you all for your help!

                  I was able to solve this issue, but the problem wasn't in the Json itself. I got a tip a tip from my colleague to check the .dll-files in the installation folder, and I noticed that they weren't entirely up to date. When I replaced them with the correct version of .dll-files the issue was solved. I still don't know exactly what caused this issue between the versions (version 5.9 and 5.10) but the issue is solved so I'm happy in either case.

                  Again, thanks!

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 7 Aug 2018, 07:30 last edited by
                  #13

                  @DanBar said in Strange Json issue, conversion from QByteArray to QJsonDocument not working as intended:

                  installation folder

                  Which installation folder do you mean? Qt? Your app?

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

                  D 1 Reply Last reply 7 Aug 2018, 11:36
                  0
                  • J jsulm
                    7 Aug 2018, 07:30

                    @DanBar said in Strange Json issue, conversion from QByteArray to QJsonDocument not working as intended:

                    installation folder

                    Which installation folder do you mean? Qt? Your app?

                    D Offline
                    D Offline
                    DanBar
                    wrote on 7 Aug 2018, 11:36 last edited by
                    #14

                    @jsulm Not the Qt folder, my own installation folder for the software I'm creating.

                    J 1 Reply Last reply 7 Aug 2018, 11:37
                    0
                    • D DanBar
                      7 Aug 2018, 11:36

                      @jsulm Not the Qt folder, my own installation folder for the software I'm creating.

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 7 Aug 2018, 11:37 last edited by
                      #15

                      @DanBar How do you create this installation directory? Qt provides tools for deployment.

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

                      D 1 Reply Last reply 8 Aug 2018, 11:41
                      0
                      • J jsulm
                        7 Aug 2018, 11:37

                        @DanBar How do you create this installation directory? Qt provides tools for deployment.

                        D Offline
                        D Offline
                        DanBar
                        wrote on 8 Aug 2018, 11:41 last edited by
                        #16

                        @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.

                        1 Reply Last reply
                        0

                        15/16

                        7 Aug 2018, 11:37

                        • Login

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