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:

  • ConvertFromJsonToXML

  • ConvertFromXMLToJson


  1. Download

  2. Extract the two folders and put them at the root of your project.

  3. Then add this library to your project:

    1. Open the Library Manager.

    1. Click Add existing library.

    1. Select the JSONXML folder and click Select a folder

    1. Click OK to exit the library manager.

  1. Then by calling the method jxml::ConvertFromJsonToXML you 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.