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. JsonWax for create json
Forum Updated to NodeBB v4.3 + New Features

JsonWax for create json

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 247 Views 1 Watching
  • 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.
  • Gabriela20G Offline
    Gabriela20G Offline
    Gabriela20
    wrote on last edited by
    #1

    Hello, someone in the community who is or has used the jsonwax library to create a json file. I am creating a file and I realized that the elements that you are creating are ordered alphabetically and I do not want that to happen

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi and welcome to the forum

      Looking in the code,
      i dont think its possible to alter that.
      There seem to be no options to control it.

      Also the docs says:
      "When converting JsonWax's internal format back to a string, the JSON-Object will always have its keys sorted alphabetically, and JSON-Arrays will always keep the same order."

      Internally a QMap is used and i think that is where the sorting comes from.
      https://github.com/doublejim/JsonWax/blob/master/JsonWaxEditor.h
      line 230
      QMap<QString, JsonType*> MAP;

      Can I ask why you want them not ordered ?

      JSON normally does not guarantee any order of the keys in objects and
      it should not be important for the using code as the app will break very asy.

      But maybe there is another way to solve what you need.

      1 Reply Last reply
      4
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by Christian Ehrlicher
        #3

        Double post - already answered here: https://forum.qt.io/topic/79451/how-to-integrate-qjson-in-qt-window-application-windows-64-bit-system/11

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        2

        • Login

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