Loading ...
Sorry, an error occurred while loading the content.

1640Re: XML - JSON bi-directional conversion?

Expand Messages
  • stephen.mckamey
    Apr 29 9:24 AM
      This "impedance mismatch" has been a source of a lot of solutions with various trade-offs. One of the first encodings is called BadgerFish which uses an '@' prefix to distinguish attributes from child elements. Many people have created variations of this to attempt to solve the various issues that arrise.

      I created JsonML (http://jsonml.org) back in 2006 to specifically deal with lossless bi-directional translation when the XML isn't data-centric but is markup-centric. When there is "mixed-mode content" most other representations can't represent it. Mixed-mode is when elements sit as siblings to textual nodes. This is uncommon in serialized XML data, but is the norm with XML markup like XHTML.

      JsonML is a less intuitive mapping than the BadgerFish-style, but it's intent was to be an intermediate format interpreted by machine not humans. In an email exchange with Crockford, we settled upon using an array as the element (rather than an object with a children array) and it reduced the size of the mapping significantly.

      The most complete list of XML-to-JSON mappings to date is on this wiki:

      http://wiki.open311.org/index.php?title=JSON_and_XML_Conversion

      It shows how a document could be translated between each of the formats and gives some good detail about each.

      --- In json@yahoogroups.com, "Dragan" <dragansr@...> wrote:
      >
      >
      > Is there some spec for XML - JSON bi-directional conversion?
      >
      > I have observed a few tools that have this feature,
      > including JSON-java by Douglas Crockford
      > <https://github.com/douglascrockford/JSON-java/blob/master> ,
      > but no description of how to resolve "impedance mismatch"
      > between data-oriented JSON and document-oriented XML...
      >
      > Here is a link to my blog comment about issues of this conversion
      > http://dragansr.blogspot.com/2011_04_10_archive.html#1877312882670385155
      > <http://dragansr.blogspot.com/2011_04_10_archive.html#187731288267038515\
      > 5>
      >
      > Thanks
      >
      > Dragan
    • Show all 4 messages in this topic