/ View Ticket
Login
Ticket UUID: ad2559db380abf8e20919136d8ff82267e1f31b3
Title: JSON does not properly escape control characters
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2016-02-04 10:28:59
Version Found In: 3.10.2
User Comments:
drh added on 2016-02-04 10:14:04:

The JSON specification requires control characters in strings to be escaped, but the JSON1 extension does not do this. For example:

SELECT json_array(char(1,8,9,10,12,13,31));

The output should be ["\u0001\b\t\n\f\r\u001f"] but the JSON1 extension leaves the characters unescaped.

This error arose because when I was coding up the JSON1 extension I missed the part in the JSON specification that says that control characters must be escaped. I understood the escapes to be optional for all characters other than " and \.