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

JSON keys not escaped #32

Closed
SNisin opened this issue Dec 21, 2019 · 2 comments
Closed

JSON keys not escaped #32

SNisin opened this issue Dec 21, 2019 · 2 comments

Comments

@SNisin
Copy link

SNisin commented Dec 21, 2019

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.

@boardhead
Copy link
Contributor

Thanks for this report. I'll fix this in the next release.

  • Phil

@boardhead
Copy link
Contributor

This should be fixed in the most recent release: 4ab0216

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

2 participants