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. Create json file with multiple arrays.
QtWS25 Last Chance

Create json file with multiple arrays.

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 228 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.
  • C Offline
    C Offline
    Cihangir
    wrote on last edited by
    #1

    Hi All,
    I'm in a mess of json arrays and objects. I want to create a Json file as follows. I've tried too many combinations but I failed. How it should be? I'm waiting for your help. Thanks All.

    The format I'm trying to do;
    {
    "Titles": [
    {
    "First" : [
    {
    "Title":"Hello"
    },
    {
    "Title":"Thank"
    },
    {
    "Title":"You"
    }
    ],
    "Last":[
    {
    "Title":"Good"
    },
    {
    "Title":"Bye"
    }
    ]
    }
    ]
    }

    jsulmJ JonBJ 2 Replies Last reply
    0
    • C Cihangir

      Hi All,
      I'm in a mess of json arrays and objects. I want to create a Json file as follows. I've tried too many combinations but I failed. How it should be? I'm waiting for your help. Thanks All.

      The format I'm trying to do;
      {
      "Titles": [
      {
      "First" : [
      {
      "Title":"Hello"
      },
      {
      "Title":"Thank"
      },
      {
      "Title":"You"
      }
      ],
      "Last":[
      {
      "Title":"Good"
      },
      {
      "Title":"Bye"
      }
      ]
      }
      ]
      }

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Cihangir Like this

      {
      	"Titles": {
      		"First": [{
      				"Title": "Hello"
      			},
      			{
      				"Title": "Thank"
      			},
      			{
      				"Title": "You"
      			}
      		],
      		"Last": [{
      				"Title": "Good"
      			},
      			{
      				"Title": "Bye"
      			}
      		]
      	}
      }
      

      ?
      There are JSON validators you can use to validate your JSON and find errors.

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

      1 Reply Last reply
      2
      • C Cihangir

        Hi All,
        I'm in a mess of json arrays and objects. I want to create a Json file as follows. I've tried too many combinations but I failed. How it should be? I'm waiting for your help. Thanks All.

        The format I'm trying to do;
        {
        "Titles": [
        {
        "First" : [
        {
        "Title":"Hello"
        },
        {
        "Title":"Thank"
        },
        {
        "Title":"You"
        }
        ],
        "Last":[
        {
        "Title":"Good"
        },
        {
        "Title":"Bye"
        }
        ]
        }
        ]
        }

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @Cihangir
        Are you looking for the text of the JSON file which @jsulm has given you, or are you looking to generate the file from code with Qt JSON classes?

        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