Main Menu

JSON metadata export

Started by Sylvain M., May 06, 2020, 06:17:15 PM

Previous topic - Next topic

Sylvain M.

Hi,
I have 2 questions about a JSON metadata export.
Is it possible to make JSON not have a line break after each object? (I think this is called a JSON minifier). Indeed, I encounter a problem in a database import post-processing because of line breaks after each object (tag).

Is it possible to have GPS coordinates in "decimal degrees" format (like with -GPSLatitude# -GPSLongitude#) in a JSON metadata export?

Thank you for your answer, and sorry if this is very basic questions.

StarGeek

I don't have anything that can help with he first question

Quote from: Sylvain M. on May 06, 2020, 06:17:15 PM
Is it possible to have GPS coordinates in "decimal degrees" format (like with -GPSLatitude# -GPSLongitude#) in a JSON metadata export?

Does the format you list not work for you?
C:\>exiftool -g1 -a -s -GPSLatitude# -GPSLongitude# -j  y:/!temp/IMG_0130.JPG
[{
  "SourceFile": "y:/!temp/IMG_0130.JPG",
  "GPS": {
    "GPSLatitude": 39.94395,
    "GPSLongitude": 105.074197222222
  },
  "Composite": {
    "GPSLatitude": 39.94395,
    "GPSLongitude": -105.074197222222
  }
}]


Otherwise, you can use the -c (coordFormat) option to format it as you like.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Sylvain M.

I misspoke, sorry (I remind you that I am not English-speaking  ;D).
I meant, IN ADDITION to all the tags available for all the files.
If I run the command you propose, I only have the GPS tags.
I'd like to have them all (including the original GPS tags), but I'd also like the version converted to decimal coordinates (to avoid having to do it in my scripts that will follow).

QuoteI don't have anything that can help with he first question
Don't worry: moreover, this is not a problem specific to Exiftool, which does its job well.
I've been given the solution for Linux [1], but since I'm on Windows, I have to either adapt scripts (Shell > Batch or Powershell) or install the Linux environment for Windows.
[1] | tr -d "\n" |

StarGeek

Quote from: Sylvain M. on May 07, 2020, 08:41:29 AM
If I run the command you propose, I only have the GPS tags.

See the last line of my post.

QuoteI've been given the solution for Linux [1], but since I'm on Windows, I have to either adapt scripts (Shell > Batch or Powershell) or install the Linux environment for Windows.
[1] | tr -d "\n" |

There are Windows ports of most Linux commands.  I installed GNU utilities for Win32 long ago and have been very satisfied with this port.

You should also note that you probably have to use tr -d "\r\n" because Windows uses a Carriage Return and a New Line at the end of each line of output.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Sylvain M.

QuoteSee the last line of my post.
Damn it! I didn't even try! (I thought this would only give me the GPS tags)
Thank you very much, I found my happiness with :
exiftool -j -r -c "%%.6f" "M:\Photos">"M:\Photos\dbphotos.json"
8)