JSON/XML Conversion in C++ ?
-
i want to convert JSON to an XML
How can i achieve it.
I am using Qt 4.8 and Windows 7 -
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 -
@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?
-
@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.
-
@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.