# How to Convert JSON to XML Using the XML Object

> Source: https://manual.pvxplus.com/how-to/how-to-convert-json-to-xml

Starting with PxPlus 2025, JSON data can be easily converted to XML by using both the **[JSON](https://manual.pvxplus.com/utilities/obj-json)** (\*obj/json) and **[XML](https://manual.pvxplus.com/utilities/obj-xml)** (\*obj/xml) objects.

The object programs, ***json.pvc*** and ***xml.pvc*** are found in the ***\*lib/obj*** directory.

*(The JSON object \*OBJ/JSON was added in PxPlus 2025.)*

These steps show you how to convert JSON data to XML by using the XML object.

|  |  |  |
| --- | --- | --- |
|  | 1\. | Create both the JSON and XML objects.<br>***Example:***<br>json_obj=new("\*obj/json")<br>xml_obj=new("\*obj/xml") |
|  | 2\. | Create JSON data using a string.<br>***Example:***<br>string$="{Address: ""Ontario"",StreetNum: 456}" |
|  | 3\. | Load the data into the JSON object.<br>***Example:***<br>json_obj'load_string(string$)<br>Note:   <br>Reusing load_string without closing the object will clear the previous data. |
|  | 4\. | Using the **Print( )** method, you can print the JSON data<br>***Example:***<br>json_obj'print()<br>![](https://manual.pvxplus.com/migration-assets/a8b284cb9bb1137bd80a68b7a1572b56466ce1c9586ea5616fb011fd9c1a48e5.png) |
|  | 5\. | Using the **Load_json( )** method, load the XML data.<br>***Example:***<br>xml_obj'load_json(json_obj) |
|  | 6\. | To view the data you just created, print the XML string by using the **Get_Xml$( )** method, which returns the XML string.<br>***Example:***<br>print xml_obj'get_xml$()<br>![](https://manual.pvxplus.com/migration-assets/d7049d4e09cd3e7b9e40002250e4e51886ba52a94569cab1982fa8ae319d18b0.png) |
|  | 7\. | Drop the **json_obj** and **xml_obj** objects.<br>***Example:***<br>drop object json_obj<br>drop object xml_obj |

## See Also

**[\*OBJ/JSON - JSON Object](https://manual.pvxplus.com/utilities/obj-json)  
[\*OBJ/XML - XML Object](https://manual.pvxplus.com/utilities/obj-xml)  
[Associative Arrays (Hash Tables)](https://manual.pvxplus.com/pxplus-user-guide/language-elements/data-types-literals-and-variables/associative-arrays-hash-tables)**  
**[DIM Define Arrays and Strings](https://manual.pvxplus.com/directives/dim)**  
**[DIM( ) Generate String/Get Array Size](https://manual.pvxplus.com/functions/dim)**  
**['JV' JSON Version](https://manual.pvxplus.com/parameters/jv)**
