common_schema
common_schema copied to clipboard
Escaped double quotes don't work in json_to_xml
SQL: select common_schema.json_to_xml('{"key":"ab"cd"}')
Expected result:
The problem is in _get_json_token line 166, as substr won't find the "" char as it expects.
Don't know how to solve it yet.
FWIW I wrote these json_to_xml
functions at a time when MySQL had no JSON
support, but did have XML/Xpath support.
These days MySQL has good JSON function library. If possible, I'd advise using them.
@shlomi-noach yeap, new mysql JSON features are in our backlog, but right now we have some legacy sheets that depend on XML, unfortunately. :(
thanks for pointing out!
@jfneis
Also {"key":"ab"cd"}
isn't valid JSON format
https://jsonlint.com/?json={%22key%22:%22ab%22cd%22}
{"key":"ab\"cd"}
is valid JSON format and escaping.
https://jsonlint.com/?json={%22key%22:%22ab%22cd%22}