Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 3 Supported XML and JSON Conversion : Normal Conversion Rule

Normal Conversion Rule
Compared with Badgerfish conversion, normal conversion is lossy but it generates much leaner and cleaner data.
The following sections outline normal conversion rules:
Mapping from JSON Data to XML Data
If the Badgerfish check box is cleared in the Configuration tab in the Parse JSON activity, normal conversion rules are applied during the mapping. Table 4 lists detailed normal conversion rules.
JSON name is xmlns or xmlns:prefix
1. If the StAXON check box under XSD schema type is selected, it handles JSON input with key _content_ in the normal way as a JSON key.
Mapping from XML Data to JSON Data
If the Badgerfish check box is cleared in the Configuration tab in the Render JSON activity, normal conversion rules are applied. Table 5 lists detailed normal conversion rules.
XML element1
XML mixed text node2

1
If the original XML element is a simple element that contains an attribute or a namespace, a _content_ key is added before the JSON content after the XML data is rendered to JSON data with the normal conversion rule.
    For example, the original XML data:
      <root>
         <a attr="test">testA</a>
         <b xmlns="namespaces">testA</b>
   </root>
     the converted JSON data:
{
"root": {
"a": {
"attr": "test",
"_content_": "testA"
},
"b": {
"xmlns": "namespaces",
"_content_": "testA"
}
}
}

2
For example, the original XML data:
    <a>
       text1
       <b>text2</b>
       text3
    </a>
     the converted JSON data:
   {
    "a":{
      "b":"text2",
      "_content_":[
        "text1",
        "test3"
       ]
      }
     }


Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved