0

Another bug in y.xmlToJson

When there's a double quote in an XML field's value that is converted to JSON with y.xmlToJson, the double quote is not escaped which leads to an invalid JSON structure. Here's a sample:

XML: <pressure_string>29.95" (1014 mb)</pressure_string>
JSON (after y.xmlToJson): "pressure_string":"29.95" (1014 mb)"
JSON (correct syntax): "pressure_string":"29.95\" (1014 mb)"

Here again, when YQL serves the JSON output, the syntax is correct. Here's a sample query:

CODE
select * from xml where url="http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=47,8"

by
2 Replies
  • QUOTE (Ivo @ Jun 24 2009, 01:53 AM) <{POST_SNAPBACK}>
    When there's a double quote in an XML field's value that is converted to JSON with y.xmlToJson, the double quote is not escaped which leads to an invalid JSON structure. Here's a sample:

    XML: <pressure_string>29.95" (1014 mb)</pressure_string>
    JSON (after y.xmlToJson): "pressure_string":"29.95" (1014 mb)"
    JSON (correct syntax): "pressure_string":"29.95\" (1014 mb)"

    Here again, when YQL serves the JSON output, the syntax is correct. Here's a sample query:

    CODE
    select * from xml where url="http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=47,8"


    Thanks for bringing this to our notice. This does look like an issue.

    -- Nagesh
    0
  • QUOTE (Nagesh Susarla @ Jun 24 2009, 10:09 AM) <{POST_SNAPBACK}>
    Thanks for bringing this to our notice. This does look like an issue.

    -- Nagesh


    Update: The issue here is with y.log() printing the string without the '\'. The actual JSON that was returned is indeed valid. That said we'll probably address this for the upcoming.next release.
    0

Recent Posts

in YQL