[MarkLogic Dev General] JSON transformation problem

Asit Nautiyal asitnautiyal at outlook.com
Tue Jan 12 04:41:41 PST 2016


Hi Soumadri,
I think in your schema, data type is int for price1 and price2. Json format returns values based on types mentioned in the schema.
Regards,Asit Nautiyal

From: SRRoyChowdhury at INNODATA.COM
To: general at developer.marklogic.com
Date: Tue, 12 Jan 2016 12:34:21 +0000
Subject: [MarkLogic Dev General] JSON transformation problem









Hi,
 
I am trying to transform the below mentioned XML data into JSON:
<data>  
  <price1>10.23</price1>
  <price2>10.00</price2>
</data>
 
When I am executing it against a database which does not have the respective schema associated I am getting the following output:
{"data":{"price1":"10.23", "price2":"10.00"}}
 
When I am executing it against a database with proper schema associated, it returns the following:
{"data":{"price1":10.23, "price2":10}}
 
Note that the second one treated the values as integer. This is not happening when the data is returned in XML format.
 
Why the function is behaving differently in the above two cases and is there a way to retain two decimal places after dot(.) even when the schema is associated?

 
Regards,
Soumadri Roy
 
 
 

"This e-mail and any attachments transmitted with it are for the sole use of the intended recipient(s) and may contain confidential , proprietary or privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and
 destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this e-mail or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful."



_______________________________________________
General mailing list
General at developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20160112/88fa4957/attachment.html 


More information about the General mailing list