Extracting metadata information of JSON file

Started by mikeice, December 01, 2022, 06:52:17 AM

Previous topic - Next topic

mikeice

Trying to extract metadata information of JSON file using Windows Executable: ExifTool-12.51.zip.
ExifTool prints JSON file content together with metadata

>exiftool.exe samplefile.json
ExifTool Version Number         : 12.51
File Name                       : samplefile.json
Directory                       : .
File Size                       : 58 bytes
File Modification Date/Time     : 2022:12:01 15:38:40+04:00
File Access Date/Time           : 2022:12:01 15:45:14+04:00
File Creation Date/Time         : 2022:12:01 15:37:17+04:00
File Permissions                : -rw-rw-rw-
File Type                       : JSON
File Type Extension             : json
MIME Type                       : application/json
Key 1                           : 1
Key 2                           : 2
Key 3 Key 4                     : 4

Is it expected behavior?

Phil Harvey

Add -json:all to the command if you just want to see the JSON information.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

mikeice

-json:all prints only JSON file content, whilst I would like to see only metadata of the file.

Phil Harvey

We have a disconnect here.  The only content of a JSON file is JSON content.  There is no other metadata.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

mikeice

I was searching for --json:all parameter. Please find ExifTool prints below.

Content of the samplefile.json:
>type samplefile.json
{
  "key1": 1,
  "key2": 2,
  "key3": {
          "key4": 4
  }

ExifTool print with -j parameter:
>exiftool.exe -j samplefile.json
[{
  "SourceFile": "samplefile.json",
  "ExifToolVersion": 12.51,
  "FileName": "samplefile.json",
  "Directory": ".",
  "FileSize": "58 bytes",
  "FileModifyDate": "2022:12:01 15:38:40+04:00",
  "FileAccessDate": "2022:12:02 11:09:22+04:00",
  "FileCreateDate": "2022:12:01 15:37:17+04:00",
  "FilePermissions": "-rw-rw-rw-",
  "FileType": "JSON",
  "FileTypeExtension": "json",
  "MIMEType": "application/json",
  "Key1": 1,
  "Key2": 2,
  "Key3Key4": 4
}]
ExifTool print with --json:all parameter:
>exiftool.exe -j --json:all samplefile.json
[{
  "SourceFile": "samplefile.json",
  "ExifToolVersion": 12.51,
  "FileName": "samplefile.json",
  "Directory": ".",
  "FileSize": "58 bytes",
  "FileModifyDate": "2022:12:01 15:38:40+04:00",
  "FileAccessDate": "2022:12:02 11:09:35+04:00",
  "FileCreateDate": "2022:12:01 15:37:17+04:00",
  "FilePermissions": "-rw-rw-rw-",
  "FileType": "JSON",
  "FileTypeExtension": "json",
  "MIMEType": "application/json"
}]