Re: A standard for XML - JSON mapping.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 1, 2016 at 6:14 AM, Carsten Bormann <cabo@xxxxxxx> wrote:
> Julian Reschke wrote:
>> I'm not sure about the futile part; AFAIU, there are valid use cases for
>> the above.
>
> Sure, IBM's format seems to work for IBM's use case.  I just think that
> trying to define a generic, application-independent mapping between JSON
> and XML is not so useful.
>
>> But XML->JSON of course is much more complex; if a generic
>> transformation is needed the result will be extremely ugly.
>
> Obviously. The XML data model (e.g., ESIS) is much more complex than
> JSON's, and whatever generic mapping from ESIS to the JSON data model is
> defined, it won't "look like JSON" in the end.

The real question is how much of the XML encoding you want to keep.

XML is really a document format and so as a guide, all the information
that appears on the page should appear as element content and
everything that does not should appear as attributes:

<h1 id="heading">This is the way you should do XML</h1>

and not:

<section  anchor="heading" title="This is not how to do XML, sorry" />


Which is why XML is not a good choice for a data markup language as
there are multiple ways to encode the same data structure to put the
bits on the wire and these differences only ever get in the way. ASN.1
has the same problem but to a much lesser degree. There are even more
stylistic choices in XML schema.

So as a general rule, I would not look to convert XML data to JSON,
instead I would look at what data structures the XML data is typically
mapped to in the applications.

In SAML/1.0, all the data structures were defined in a data
description language and that was used to emit the XML schema in a
regular fashion. So there is a fairly straightforward mapping but not
one that is evident from the schema.

If you wanted to have a Web Service that presented JSON and XML front
ends, then a data description language is the way to go.


If you do VisualStudio, my tool is now open source and available as a
VSIX extension. Otherwise you can pull the code and run it on any
platform that has .NET:

https://github.com/hallambaker/PHB-Build-Tools

The code can also generate ASN.1 if you really want.




[Index of Archives]     [IETF Annoucements]     [IETF]     [IP Storage]     [Yosemite News]     [Linux SCTP]     [Linux Newbies]     [Fedora Users]