RE: Totally non-conformant JSON hack

Thanks.
Not worried about niceness or elegance ... but am concerned about using a
'convention' that will have some lifetime.
Have you considered JSONx which is (has been?) introduced to the public
domain (after being patented by IBM) ?
http://publib.boulder.ibm.com/infocenter/wsdatap/v3r8m1/index.jsp?topic=%2Fx
i50%2Fconvertingbetweenjsonandjsonx06.htm

Its not my favorite but it has some backing ...
Then there *is* my favorite  (JXML which has no backing) but does model the
JSON data model more directly then JSONx

http://xml.calldei.com/JsonXML

Any model that is lossless is fine but It is beginning to concern me the
proliferation of lossless JSON/XML models.

It would be nice if the community could narrow down rather then proliferate
on if not a 'standard' atleast a 'common' way of translating JSON to XML in
a lossless format.




----------------------------------------
David A. Lee
dlee@calldei.com
http://www.xmlsh.org


-----Original Message-----
From: xproc-dev-request@w3.org [mailto:xproc-dev-request@w3.org] On Behalf
Of Norman Walsh
Sent: Monday, October 10, 2011 9:19 AM
To: XProc Dev
Subject: Re: Totally non-conformant JSON hack

David Lee <dlee@calldei.com> writes:

> I must have missed this "conformant" XML-JSON mapping.

It's conformant for p:unescape-markup to convert JSON to XML because the
spec says

  An implementation may use a different parser to produce XML content
  depending on the specified content-type. For example, an
  implementation might provide an HTML to XHTML parser (e.g. [HTML
  Tidy] or [TagSoup]) for the content type 'text/html'.

For the content type "application/json", I use a parser that produces XML
like this:

<c:json xmlns:c="http://www.w3.org/ns/xproc-step" type="object">
   <c:pair name="id" type="string">1180513108190941...</c:pair>
   <c:pair name="nullvalue" type="null"/>
   <c:pair name="image" type="object">
      <c:pair name="url" type="string">https://...</c:pair>
   </c:pair>
   <c:pair name="boolean" type="boolean">false</c:pair>
   <c:pair name="displayName" type="string">John Doe</c:pair>
   <c:pair name="kind" type="string">plus#person</c:pair>
   <c:pair name="url" type="string">https://...</c:pair>
   <c:pair name="array" type="array">
      <c:item type="number">1</c:item>
      <c:item type="number">2</c:item>
      <c:item type="number">3</c:item>
   </c:pair>
</c:json>

There's nothing particularly elegant or nice about that markup, but
the first reasonable Java library I found produced it. And it does
have the benefits of being regular and handling arbitrary names.

I'm open to suggestions for better vocabularies, I suppose.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
www.marklogic.com

Received on Monday, 10 October 2011 14:11:19 UTC