JSONx conversion example

Example document that shows JSON to JSONx conversion.

The following example document is a sample of the JSON structure.
  "name":"John Smith",
  "address": {
    "streetAddress": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postalCode": 10021,
  "phoneNumbers": [
    "212 555-1111",
    "212 555-2222"
  "additionalInfo": null,
  "remote": false,
  "height": 62.4,
  "ficoScore": " > 640"
The following output is the result of the transformed document as JSONx.
<?xml version="1.0" encoding="UTF-8"?>
<json:object xsi:schemaLocation="http://www.datapower.com/schemas/json jsonx.xsd"
  <json:string name="name">John Smith</json:string>
  <json:object name="address">
    <json:string name="streetAddress">21 2nd Street</json:string>
    <json:string name="city">New York</json:string>
    <json:string name="state">NY</json:string>
    <json:number name="postalCode">10021</json:number>
  <json:array name="phoneNumbers">
    <json:string>212 555-1111</json:string>
    <json:string>212 555-2222</json:string>
  <json:null name="additionalInfo" />
  <json:boolean name="remote">false</json:boolean>
  <json:number name="height">62.4</json:number>
  <json:string name="ficoScore"> > 640</json:string>

JSON identifiers are represented by the string contents in the name attribute. Most Unicode characters are valid within identifiers, when they are properly escaped (for example, \unnnn). Identifiers must not be European Computer Manufacturers Association (ECMA) reserved words. The DataPower® Gateway does not validate JSON property names beyond the JSON specification.