XML to JSON Policy using yahoo format conversions are inconsistent

Not applicable

I have come across a situation where i have an xml with two decimal values and one is converted to string and the other to a numeric value.

XML: http://pastie.org/private/pzsbdzzurruf5aufuzoa

JSON: http://pastie.org/private/avheaslsywbuvtllxcfpw

The xml file above is the xml that is being converted to json using xml to json policy. In the JSON file if you notice the "price" field you can see that the value .5 is a string where as 3.01 is a numeric value.

Initially I had the doubt that the value ".5" is not preceeded by 0("0.5") which could be the reason. But then I tried other online XMLtoJSON convertors and they all converted both values to strings.

@Mike Dunker Could you please take a look at this?

0 1 621
1 REPLY 1

Hi @amukta.a - apigee implementation uses this logic to recognize numbers http://www.json.org/number.gif

So, thats the reason .5 is treated as string, 0.5 would be treated as a number

In your case, if you have the schema - probably you could update the values in JS policy for consistency.