Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. JSON/XML Conversion in C++ ?
Forum Updated to NodeBB v4.3 + New Features

JSON/XML Conversion in C++ ?

Scheduled Pinned Locked Moved C++ Gurus
5 Posts 4 Posters 8.4k Views 3 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.
  • I Offline
    I Offline
    IamSumit
    wrote on 10 Mar 2014, 08:39 last edited by
    #1

    i want to convert JSON to an XML
    How can i achieve it.
    I am using Qt 4.8 and Windows 7

    Be Cute

    F 1 Reply Last reply 13 May 2020, 15:47
    0
    • A Offline
      A Offline
      andreyc
      wrote on 10 Mar 2014, 19:08 last edited by
      #2

      If your JSON to XML is pretty trivial then you can convert it manually by reading from JSON and writing to XML.
      If the conversion is not trivial then I would suggest to use XSLT to transform and call XSLT processor from C++.
      Some links "xml2json":https://github.com/Cheedoong/xml2json
      If you are going to use Windows only then take a look on MSDN they should have some info about "JSON to XML":http://msdn.microsoft.com/en-us/library/vstudio/bb924435.aspx

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Durgesh
        wrote on 12 May 2020, 05:12 last edited by
        #3

        @andreyc said in JSON/XML Conversion in C++ ?:

        If your JSON to XML is pretty trivial

        @IamSumit Could you have done JSON to XML conversion?

        1 Reply Last reply
        0
        • F Offline
          F Offline
          fcarney
          wrote on 13 May 2020, 15:43 last edited by
          #4

          @andreyc said in JSON/XML Conversion in C++ ?:

          I would suggest to use XSLT to transform

          XSLT requires the source document to be XML. It can do XML to JSON, but not JSON to XML.

          C++ is a perfectly valid school of magic.

          1 Reply Last reply
          0
          • I IamSumit
            10 Mar 2014, 08:39

            i want to convert JSON to an XML
            How can i achieve it.
            I am using Qt 4.8 and Windows 7

            F Offline
            F Offline
            fcarney
            wrote on 13 May 2020, 15:47 last edited by
            #5

            @IamSumit said in JSON/XML Conversion in C++ ?:

            i want to convert JSON to an XML

            I think Qt probably has enough in it to do this. Read up on how to read and parse through a JSON document using the Qt library. Do a recursive printout of the structure to text. Then once you are confident you are reading the entire document then use the Qt library to create your XML document. Also print this out to make sure it matches what you want. You will have to determine a convention of how to translate and this might just be a simple lookup table or a set of rules.

            C++ is a perfectly valid school of magic.

            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