ExifTool Forum

ExifTool => Developers => Topic started by: herb on September 07, 2018, 06:57:27 AM

Title: Question to -json output and option -a
Post by: herb on September 07, 2018, 06:57:27 AM
Hello Phil,

I hope not to annoy you again with my questions.
During past weeks I asked many many questions and very often you answered: it is better to use -json output.

Well, I started to use -json option and have the following question:
I have a *.jpg image that contains 2 tags with identical name: -iptc:DateCreated and -xmp-photoshop:DateCreated

When I use the following command
exiftool.exe -json -l -a -api struct=2 -all:all testimage.jpg
I get only 1 tag displayed for DateCreated.

When I add e.g. option -g0:1 I get displayed both tags DateCreated

I had expected that always both tags are displayed because of option -a.

Thanks for help in advance.
Best regards
Herb
Title: Re: Question to -json output and option -a
Post by: Phil Harvey on September 07, 2018, 07:33:35 AM
Hi Herb,

From the -json documentation:

            The -a option is implied if the -g or -G options are used,
            otherwise it is ignored and duplicate tags are suppressed.

This is because JSON names must be unique.

- Phil
Title: Re: Question to -json output and option -a
Post by: herb on September 07, 2018, 07:40:49 AM
Hello Phil,

thanks for your quick reply and sorry, I have overseen this detail in documentation.

Best regards
Herb
Title: Re: Question to -json output and option -a
Post by: Phil Harvey on September 07, 2018, 07:49:00 AM
Note that you can use -g0:1:4 to make sure JSON names are unique for all tags.  I will update the documentation to mention this:

            The -a option is implied if the -g or -G options are used,
            otherwise it is ignored and tags with identical JSON names
            are suppressed. (-g4 may be used to ensure that all
            tags have unique JSON names.)

- Phil