To get to the level of granularity you want you will need to use the JSON 
XQuery library (new in 6.0)
I dont belive it is exposed in REST calls.  (would love to be wrong !)

http://docs.marklogic.com/json-lib

If you use the "custom" strategy you can fine tune quite a lot using 
configuration options

http://docs.marklogic.com/json:config


Including what elements become arrays.

To actually override the atomic types of things you need some "undocumented 
features" which I could share offline but are not officially supported.

To *JUST* handle atomic type issues, you could consider a very basic schema 
that only specifies the elements you are concerned about
and wildcards the rest.




-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
[email protected]
Phone: +1 812-482-5224
Cell:  +1 812-630-7622
www.marklogic.com


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Wednesday, December 19, 2012 9:00 AM
To: [email protected]
Subject: Re: [MarkLogic Dev General] MarkLogic 6 XML to JSON DataTypes

Hi David

Currently I am not using Schema as there are few limitation to it while 
validations. Currently I am using Schematron for validation of content.

Is there any where we I can specify list of elements which should be treated as 
numbers/Boolean/string similar to enforcing elements as arrays we have?

Thanks and Regards,

Gnanaprakash Bodireddy

Date: Wed, 19 Dec 2012 12:50:44 +0000
From: David Lee <[email protected]>
Subject: Re: [MarkLogic Dev General] MarkLogic 6 XML to JSON DataTypes
To: MarkLogic Developer Discussion <[email protected]>
Message-ID:
        <6ad72d76c2d6f04d8be471b70d4b991e018...@exchg10-be02.marklogic.com>
Content-Type: text/plain; charset="iso-8859-1"

If there is a schema present which identifies <id> as a numeric type then it 
come out as unquoted.
Similar for booleans.

Otherwise the code has no idea that id is not a string ... and for consistancy 
it treats all untyped atomic valus as strings so you dont get Mis matched data 
like

<user>
                <id>1</id>
                <name>Gnana</name>
</user>

<user>
                <id>a1</id>
                <name>Gnana</name>
</user>




? What type to assign "id" elements in JSON


From: [email protected] 
[mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Wednesday, December 19, 2012 6:41 AM
To: [email protected]
Subject: [MarkLogic Dev General] MarkLogic 6 XML to JSON DataTypes

Hi

I am exploring MarkLogic "XML to JSON" Rest API and am stuck with how to handle 
data types.

For example:
<user>
                <id>1</id>
                <name>Gnana</name>
</user>

Actual JSON Response:
{"user":{"id":"1", "name":"Gnana"}}

Expected JSON Response:
{"user": {"id":1, "name":"Gnana"}}

How can I make sure integer/float/decimal/Boolean data types are not inside 
quotes. Is there any specific config options I could use?

Thanks and Regards,

Gnanaprakash Bodireddy
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to