Numeric to string conversion

Started by thdbased, August 08, 2016, 09:50:53 AM

Previous topic - Next topic

thdbased

Greetings,

I have a question about the conversion from a numeric value to a string value. I have a custom property in my XMP (custom namespace) which can have a value like "7E3" or "6G9". The problem is that exif outputs the "7E3" value as a numeric value (no string), the "6G9" value however is outputted as a string. Obviously the problem is with the E notation has to do with it being treated as a float (prob).

How can I make sure the exif output always returns the property as a string?

Thx,

Thdbased


Hayo Baan

If the tag is a string, then ExifTool will output it as a string (without quotes). My guess is you are importing the output into another program which is doing the conversion... If that is not true, can you show us the output of ExifTool?
Hayo Baan – Photography
Web: www.hayobaan.nl

thdbased

#2
I'm seeing the string/numeric change when use the -json param. So I'm guessing it parses the output as JSON and that is causing the issue. Isn't there a way to prevent this "conversion" from happening?

When I'm not using json param I can't tell the type of the value.

Phil Harvey

The values output by exiftool are not typed, which leads to problems when converting for the JSON output.  If it looks like a number, then ExifTool writes a JSON number, otherwise it quotes it as a string.

- 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 ($).