Re: Totally non-conformant JSON hack

David Lee <dlee@calldei.com> writes:
> Thanks, I'm going to start moving to this as well in xmlsh and JXON 
>
> The fewer "standards" doing exactly the same thing the better.

After some more thought over lunch, I think I may just make it
user-configurable. I have five variations in mind and it's not clear
that one is uniformly superior to all the others:

1. My own hack w/o a namespace (deprecated)
2. My own hack in the XProc step namespace
3. JSONx
4. JXON
5. An element-name based syntax with some escaping:

<j:json xmlns:j="http://marklogic.com/json" type="object">
   <j:id type="string">118051310819094153327</j:id>
   <j:_ type="string">empty string</j:_>
   <j:_0031foo_0024bar type="string">1foo$bar</j:_0031foo_0024bar>
   <j:x_003ahtml type="string">x:html</j:x_003ahtml>
   <j:nullvalue type="null"/>
   <j:foo_0024bar type="string">foo$bar</j:foo_0024bar>
   <j:image type="object">
      <j:url type="string">https://lh5.googleusercontent.com/-XnZDEoiF09Y/AAAAAAAAAAI/AAAAAAAAYCI/7fow4a2UTMU/photo.jpg</j:url>
   </j:image>
   <j:boolean type="boolean">false</j:boolean>
   <j:displayName type="string">Chirag Shah</j:displayName>
   <j:url type="string">https://plus.google.com/118051310819094153327</j:url>
   <j:kind type="string">plus#person</j:kind>
   <j:array type="array">
      <j:item type="number">1</j:item>
      <j:item type="number">2</j:item>
      <j:item type="number">3</j:item>
   </j:array>
</j:json>

This one happens to work really well in an environment where you've got
an index on element names :-)

                                        Be seeing you,
                                          norm

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

Received on Monday, 10 October 2011 18:50:58 UTC