Skip to content

execute_json should set the ExifTool param -struct too  #52

@nitmws

Description

@nitmws

Currently calling execute_json sets only -j as ExifTool parameter - but it does not set the -struct parameter. That's a dangerous for metadata properties with structured values and multiple values.

Example: the IPTC Photo Metadata Standard defines a property Location Shown in the Image which has a structure of City, State/Province, Country Name, Country Code, Sublocation and more. And it may have multiple values = multiple structures.

Using the -j (JSON) parameter without the -struct parameter returns such a result:

"XMP:LocationShownCity": ["City (Location shown2) (ref2021.1)"],
"XMP:LocationShownCountryCode": ["ABC","ABC"],
"XMP:LocationShownCountryName": ["CountryName (Location shown1) (ref2021.1)","CountryName (Location shown2) (ref2021.1)"],
"XMP:LocationShownSublocation": ["Sublocation (Location shown1) (ref2021.1)"],

Using the -j (JSON) parameter WITH the -struct parameter returns such a result:

"XMP:LocationShown": [{
    "CountryCode": "ABC",
    "CountryName": "CountryName (Location shown1) (ref2021.1)",
    "Sublocation": "Sublocation (Location shown1) (ref2021.1)"
  },{
    "City": "City (Location shown2) (ref2021.1)",
    "CountryCode": "ABC",
    "CountryName": "CountryName (Location shown2) (ref2021.1)"
  }],

The essential difference: the XMP:LocationShownCity and the XMP:LocationShownSublocation of the result without -struct have only a single value in the array, but knowbody knows if this is the City name or Sublocation name of the first location of of the second location. While the XMP:LocationShown has a JSON object for each location and the first object has no City but a Sublocation, the second object has a City but no Sublocation. Which location has what structured data is crystal clear.

(Note: the results above are taken from the IPTC Photo Metadata reference image, it has values telling to which property it belongs.)

With this semantic issue as background I suggest to set the -struct parameter with the -j parameter in the execute_json method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions