Fix double escaping in the metadata of FORMAT JSON

This commit is contained in:
Alexey Milovidov 2022-07-30 23:56:41 +02:00
parent 2bdc926572
commit 4828be7fc4
4 changed files with 26 additions and 2 deletions

View File

@ -529,7 +529,12 @@ namespace JSONUtils
writeObjectStart(out, 2);
writeTitle<true>("name", out, 3);
writeDoubleQuoted(fields[i].name, out);
/// The field names are pre-escaped to be put into JSON string literal.
writeChar('"', out);
writeString(fields[i].name, out);
writeChar('"', out);
writeFieldDelimiter(out);
writeTitle<true>("type", out, 3);
writeJSONString(fields[i].type->getName(), out, settings);

View File

@ -72,7 +72,7 @@ protected:
size_t field_number = 0;
size_t row_count = 0;
NamesAndTypes fields;
NamesAndTypes fields; /// The field names are pre-escaped to be put into JSON string literal.
Statistics statistics;
FormatSettings settings;

View File

@ -0,0 +1,18 @@
{
"meta":
[
{
"name": "\"",
"type": "String"
}
],
"data":
[
{
"\"": "\\"
}
],
"rows": 1
}

View File

@ -0,0 +1 @@
SELECT '\\' AS `"` FORMAT JSON SETTINGS output_format_write_statistics = 0;