| How to Convert XML to JSON | 
Starting with PxPlus 2025, XML data can be easily converted to JSON by using the XML Object (*obj/xml). The object programs, json.pvc and xml.pvc are found in the *lib/obj directory.
These steps show you how to set up XML data and then convert the XML data to JSON.
These steps show you how to set up XML data.
| 
 | 1. | Create both the JSON and XML objects. Example: json_obj=new("*obj/json") xml_obj=new("*obj/xml") | 
| 
 | 2. | Using the Set_Xml( ) method, load and create nodes in a given XML string. Example: xml_obj'set_xml("<emp><name>John Smith</name><addr>456 Ontario Street</addr><age>40</age></emp>") | 
| 
 | 3. | To view the data you just created, you can print the XML string by using the Get_Xml$( ) method, which returns the XML string. Example: print xml_obj'get_xml$()       | 
These steps show you how to convert XML data to JSON format.
| 
 | 1. | Load the XML data you created above. Example: json_obj'load_xml(xml_obj) | 
| 
 | 2. | Using the Print( ) method, you can print the JSON data Example: json_obj'print()       | 
| 
 | 3. | If you want to load the XML object without numeric conversion, then the examples for Step 1 and Step 2 would look like this: Example: json_obj'load_xml(xml,0) Using the Print( ) method, you can print the JSON data. Example: json_obj'print()       | 
| 
 | 4. | Drop the json_obj and xml_obj objects. Example: drop object json_obj drop object xml_obj | 
*OBJ/XML - XML Object
*OBJ/JSON - JSON Object
Associative Arrays (Hash Tables)
DIM Define Arrays and Strings
DIM( ) Generate String/Get Array Size
'JV' JSON Version