Skip to content
This repository was archived by the owner on Jul 19, 2022. It is now read-only.
This repository was archived by the owner on Jul 19, 2022. It is now read-only.

Tagged XML format #12

Closed
Closed
@TheMadButcher

Description

@TheMadButcher

Hi,

I have some changes that implements a tagged XML format.
I use this in several of my projects where I need to use both JSON and SOAP services.

If you would like to review and add my code, please drop me a line :)

JSONTaggedXML sample

The following example document is a sample of the JSON structure.

{
  "name/surname":"John Smith",
  "address": {
    "streetAddress": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postal-code": 10021,
  },
  "IDs": [
    "2-111",
    "2-222"
  ],
  "additionalInfo": null,
  "remote": false,
  "height": 62.4,
  "ficoScore": "> 640"
}

The following output is the result of the transformed document to JSONTaggedXML.

<?xml version="1.0" encoding="UTF-8"?>
<JsonItem>
  <name type="json:string" name="name">John Smith</name>
  <address type="json:object" name="address">
    <streetAddress type="json:string" name="streetAddress">21 2nd Street</streetAddress>
    <city type="json:string" name="city">New York</city>
    <state type="json:string" name="state">NY</state>
    <postalCode type="json:number" name="postalCode">10021</postalCode>
  </address>
  <phoneNumbers type="json:array" name="phoneNumbers">
    <JsonItem type="json:string">212 555-1111</JsonItem>
    <JsonItem type="json:string">212 555-2222</JsonItem>
  </phoneNumbers>
  <additionalInfo type="json:null" name="additionalInfo" />
  <remote type="json:boolean" name="remote">false</remote>
  <height type="json:number" name="height">62.4</height>
  <ficoScore type="json:string" name="ficoScore">&gt; 640</ficoScore>
</JsonItem>

Regards,

TMB

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions