[MarkLogic Dev General] JSON with MarkLogic

Shannon Shiflett at virginia.edu
Thu Jun 14 07:03:16 PDT 2012


You're right, David, having thought it out some more, that's what I arrived at too--see my last post. I'm thinking about jQuery UI widgets. Sure I could send XML and parse it, but there are advantages to JSON. Provided that there are one or two common use cases, is it fair, and not so terribly tricky, to expect a specified XML structure as input xdmp:to-json? Although even then it sounds like there could be trouble based on your answer. I'm sure I need to look into the aforementioned libraries, though wanted to give Justin that feedback.

On Jun 14, 2012, at 9:40 AM, David Lee wrote:

> Thanks for your feedback.
> What you are asking for is a particularly tough model to translate without complex custom code.   It takes recognizing pairs (tripples? quadruples? ...) of replicated element names as representing arrays.  In fact the XML example you show is difficult to deal with in the pure XML realm as well.
> 
> Something like this would be easier to recognize/configure as a JSON array and/or process with pure XML tools
> 
> <objects>
> <object>
> <label>value</label>
> <category>books</category>
> </object>
> <object>
> <label>value2</label>
> <category>books2</category>
> </object>
> 
> ...
> </object>
> 
> 
>> -----Original Message-----
>> From: general-bounces at developer.marklogic.com [mailto:general-
>> bounces at developer.marklogic.com] On Behalf Of Shannon
>> Sent: Thursday, June 14, 2012 9:22 AM
>> To: MarkLogic Developer Discussion
>> Subject: Re: [MarkLogic Dev General] JSON with MarkLogic
>> 
>> Correction:
>> 
>>> <object>
>>> <label>value</label>
>>> <category>books</category>
>>> [...]
>>> </object>
>> 
>> 
>> On Jun 14, 2012, at 9:17 AM, Shannon wrote:
>> 
>>> Justin stated that MarkLogic is looking to improve built-in JSON support and
>> requested details on what we are trying to accomplish. It is helpful for
>> returning an array of strings, but I'm seeking to convert an XML structure into
>> an array of objects, e.g.,
>>> 
>>> <object>
>>> <label>value</l>
>>> <category>books</l>
>>> [...]
>>> </object>
>>> 
>>> =>
>>> 
>>> [ { label: "value", category: "books" }, ... ]
>>> 
>>> I know about mljson and map:map, but I wanted to share a frequent case
>> that could make xdmp:to-json more useful--maybe flags for alternate
>> serializations?
>>> 
>>> Thanks,
>>> 
>>> 	Shannon (Shiflett at virginia.edu)
>>> 		http://www.facebook.com/uvapress
>>> 		http://www.twitter.com/uvapress
>>> 
>>> _______________________________________________
>>> General mailing list
>>> General at developer.marklogic.com
>>> http://community.marklogic.com/mailman/listinfo/general
>> 
>> _______________________________________________
>> General mailing list
>> General at developer.marklogic.com
>> http://community.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://community.marklogic.com/mailman/listinfo/general



More information about the General mailing list