Bug #76598 MySQL JSON UDFs: json_extract does not appear to unescape quotes within JSON
Submitted: 6 Apr 2015 4:00 Modified: 6 Apr 2015 7:45
Reporter: Jason Baumgartner Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: JSON User-defined function ( UDF ) Severity:S3 (Non-critical)
Version:0.4.0 OS:Linux (Ubuntu 14.04)
Assigned to: CPU Architecture:Any
Tags: mysql-json-udfs-0.4.0

[6 Apr 2015 4:00] Jason Baumgartner
Valid JSON requires escaping quotes within key values.  Example:

{"string":"This is \"some quoted\" text."}

When decoded, the "string" key should be:  This is "some quoted" text.

However, the json_extract does not appear to unescape the JSON escaped quotes.

How to repeat:
SELECT json_extract('{"string":"\\\"quoted text\\\""}','string');

| json_extract('{"string":"\\\"quoted text\\\""}','string') |
| \"quoted text\"                                           |

Suggested fix:
This should return "quoted text" (with the double quotes) and unescape the JSON escaped double quotes by removing the slashes.
[6 Apr 2015 7:45] MySQL Verification Team
Hello Jason Baumgartner,

Thank you for the report.
Observed this with 0.4.0 and MySQL 5.6.25.