convert JSON to XML()

Prev Next

Converts the content of a JSON file in parameter a into XML content.

You can use parameter b to save the generated XML content into an XML object (DOM).

Parameters

Parameter

Description

a

Value to convert (content of a JSON file).

b

(optional) If you specify a name here, the generated XML content will be stored in an XML object (DOM). You access this object with function get value from XML(), for example.

Example

We enter the following JSON content in parameter a.

{
	"termsofpayment1":"",
	"vat2":"7",
	"ilnsupp":"123456789",
	"free_text":"",
	"orderno":"4711",
	"vat1":"19",
	"ilnreceiver":"",
	"deliverynoteno":"0815",
	"invoicno":"08154711",
	"termsofpayment2":"",
	"currency":"EUR",
	"ilnbuyer":"400000045687",
	"complexposition_position":[
					{
					"amount":200,
					"unit":"PCE",
					"vat_pos":"19",
					"itemno_supp":"87490",
					"content":"Sausages",
					"positionno":"1",
					"price":30,
					"EAN":"3654878784"
					},
					{
					"amount":1,
					"unit":"PCE",
					"vat_pos":"",
					"itemno_supp":"8786767",
					"content":"",
					"positionno":"2",
					"price":56,
					"EAN":"546546"
					}
				 ]
}

As a result we get the following XML content.

<root>
	<JsonData>
		<termsofpayment1/>
		<vat2>7</vat2>
		<ilnsupp>123456789</ilnsupp>
		<free_text/>
		<orderno>4711</orderno>
		<vat1>19</vat1>
		<ilnreceiver/>
		<deliverynoteno>0815</deliverynoteno>
		<invoicno>08154711</invoicno>
		<termsofpayment2/>
		<currency>EUR</currency>
		<ilnbuyer>400000045687</ilnbuyer>
		<complexposition_position>
			<amount>200</amount>
			<unit>PCE</unit>
			<vat_pos>19</vat_pos>
			<itemno_supp>87490</itemno_supp>
			<content>Sausages</content>
			<positionno>1</positionno>
			<price>30</price>
			<EAN>3654878784</EAN>
		</complexposition_position>
		<complexposition_position>
			<amount>1</amount>
			<unit>PCE</unit>
			<vat_pos/>
			<itemno_supp>8786767</itemno_supp>
			<content/>
			<positionno>2</positionno>
			<price>56</price>
			<EAN>546546</EAN>
		</complexposition_position>
	</JsonData>
</root>