Convert JSON to XML and visa versa
When you need input data from JSON files, you first need to convert JSON files to XML files to make the data compatible with AIMMS.
Here we provide a conversion tool in the form of a custom AIMMS library. It contains a conversion AIMMS library between XML and JSON files:
Extract the two folders and put them at the root of your project.
Then add this library to your project:
Open the Library Manager.
Click Add existing library.
JSONXMLfolder and click Select a folder
Click OK to exit the library manager.
Then by calling the method
jxml::ConvertFromJsonToXMLyou should be able to obtain your data into an XML file.
Execute the following code to create the XML file:
During the conversion, the general structure of the JSON file is conserved. For every JSON element, an XML element is created.
Note that if the JSON element had a name, then it will be set as a parameter of the corresponding XML element.