JSON keys not escaped
SNisin opened this issue · comments
Sergej Nisin commented
I noticed that when running exiftool on json files with -j -struct
, the keys will not be escaped in the output which can create invalid JSON output.
Example:
test.json
{
"transform": {
"\\.\"": "\\.\""
}
}
Exiftool produces:
> .\exiftool.exe test.json -j -struct
[{
"SourceFile": "test.json",
"ExifToolVersion": 11.80,
"FileName": "test.json",
"Directory": ".",
"FileSize": "46 bytes",
"FileModifyDate": "2019:12:21 22:15:20+01:00",
"FileAccessDate": "2019:12:21 22:15:20+01:00",
"FileCreateDate": "2019:12:21 21:56:09+01:00",
"FilePermissions": "rw-rw-rw-",
"FileType": "JSON",
"FileTypeExtension": "json",
"MIMEType": "application/json",
"Transform": {
"\."": "\\.\""
}
}]
As you can see "\.""
is invalid JSON as both \
and "
are not escaped.
Phil Harvey commented
Thanks for this report. I'll fix this in the next release.
- Phil
Phil Harvey commented
This should be fixed in the most recent release: 4ab0216