I'm curious to your remark that this is not valid JSON. If you pass it through
jsonlint, the JSON is 'valid'. I get what you are saying in terms of how you
need to access the objects from the client side (can't directly use dot
notation). The whole issue of being able to roundtrip XML (XML-> JSON -> XML)
is an interesting challenge for the XML community. In particular, since there
are not truly official concepts such as namespaces in JSON, then how does one
'record' this information from the XML to the JSON (so it could potentially be
returned as XML again). The approach I have often seen taken is to use the
namespace prefix approach (such as corona:). While the complexity of XML
allows one to use different prefixes (for the same namespace in different
documents), I would say this is fairly rare for most. At least in my
experience, if something is 'dublin core', then it is always 'dct:' or if it is
'prism', then it is always 'prism:'.
But, the tradeoff of including the prefix: in the JSON is it impacts the
client's ability to process the JSON (as you correctly point out). You of
course have the whole query side (of the JSON) as well. I'm thinking not only
MarkLogic but other native JSON databases such as Mongo.
Darin.
________________________________
From: Andy Fitzgerald <[email protected]>
To: MarkLogic Developer Discussion <[email protected]>
Sent: Wednesday, April 25, 2012 7:47 AM
Subject: Re: [MarkLogic Dev General] Corona Question: Turn off default
namespace in JSON response.
Hi,
Thanks for getting back to me.
The reason I want to remove it is that its not valid JSON. Parsing it in the UI
works fine by using the response['corona:total'] but its a lot cleaner just to
have the attributes and use dot notation on each one.
Its only a minor thing but was curious if there was an option to turn it off
after seeing on the api docs that it displays without the namespace.
Regards
Andy
On Wed, Apr 25, 2012 at 12:21 PM, Clark Richey <[email protected]>
wrote:
Andy,
>There is no way to do that at this time. Can you please explain why you wish
>to remove the namespace?
>
>Sent from my iPhone
>
>
>On Apr 25, 2012, at 6:45, "Andy Fitzgerald" <[email protected]> wrote:
>
>> Hi there,
>>
>> Looking for a way to change the default namespace coming back in the json
>> feed. Currently when a Search query returns we get the following:
>>
>> {"corona:response":{"corona:meta":{"corona:start":"1","corona:end":"2","corona:total":"3267","corona:executionTime":"0.01"}
>> ...
>>
>> I am looking to remove the corona namespace and get the following back:
>>
>> {"response":{"meta":{"start":"1","end":"2","total":"3267","executionTime":"0.01"}
>> ...
>>
>> I'm looking the output options to see if I can change it but I am not sure
>> which one to choose.
>>
>> Thanks,
>>
>> Andy
>>
>>
>>
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
>_______________________________________________
>General mailing list
>[email protected]
>http://developer.marklogic.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general