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: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of 
gnanaprakash.bodire...@cognizant.com
Sent: Wednesday, December 19, 2012 6:41 AM
To: general@developer.marklogic.com
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
Sr Associate - Projects | IME
Cognizant Technology Solutions
VNET: 672103
(O): +91 (40) 44514444 extn: 672103
(M): +91-8897575644

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
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to