pc:JsonToXml

Previous Next

 

  Remains to be implemented.

 

Converts JSON code to an equivalent XML fragment for the purpose of processing in a USoft Blend context.

Syntax

<pc:JsonToXml assign:variable="xpath">

 
    content

 
</pc:JsonToXml>

The required content must be well-formed JSON code. An example is in Example 2.

The optional assign:variable is a typical strategy for catching the result in a Blend variable which you can then reference in a later directive.

 

Example 1

This example reads a JSON file, converts it to XML, and stores the XML in a variable called mydata. You can use $mydata later in the script to refer to the XML.

<pc:JsonToXml assign:mydata="." >
    <pc:ReadFile filepath="c:\temp\myfile.json"/>
</pc:JsonToXml>

 

Example 2

This example reads the embedded JSON code, converts it to XML, and stores the entire XML fragment in a variable called allmydata and the individual API_ADDRESS setting in a variable called myapi. You can use $allmydata and $myapi later in the script to refer to the XML.

<pc:assign-nodeset allmydata="{.}" myapi="{*/API_ADDRESS}">
    <pc:JsonToXml>
      {
        "API_ADDRESS": "http://60.1.0.81:xxxx/pcdm/v1/api"
        "MEASURE_SERVICE": "/measures/"
      }
    </pc:JsonToXml>
</pc:assign-nodeset>