Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escaped double quotes don't work in json_to_xml #17

Open
jfneis opened this issue Jan 8, 2019 · 3 comments
Open

Escaped double quotes don't work in json_to_xml #17

jfneis opened this issue Jan 8, 2019 · 3 comments

Comments

@jfneis
Copy link
Collaborator

jfneis commented Jan 8, 2019

SQL: select common_schema.json_to_xml('{"key":"ab"cd"}')
Expected result: ab\cd
Current result: NULL

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.

@shlomi-noach
Copy link
Owner

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.

@jfneis
Copy link
Collaborator Author

jfneis commented Jan 8, 2019

@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!

@RaymondNijland
Copy link

RaymondNijland commented Aug 28, 2019

@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}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants