Converting JSON to a struct in Go
I'm in the process of writing a little command line app in Go that uploads images to Flickr. It's called Rodeo and it's working well as a project with which to learn Go in 2020. Rodeo uses ExifTool to interrogate an image file for meta data. ExifTool is wonderful and very comprehensive and with the -j switch can return JSON. Today I want to note down what I learned about dealing with JSON.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$ exiftool -j -iptc:* -exif:* RKA-glorious.jpeg [{ "SourceFile": "RKA-glorious.jpeg", "Country-PrimaryLocationName": "United Kingdom", "Caption-Abstract": "On a wet gala weekend, Glorious returns after its 2018-19 restoration", "Keywords": ["diesel","50 033","Severn Valley Railway","Glorious","railway"], "ObjectName": "Glorious Sunrise", "ImageDescription": "On a wet gala weekend, Glorious returns after its 2018-19 restoration", "Make": "FUJIFILM", "Model": "X-T3", "ISO": 500, "DateTimeOriginal": "2019:10:04 11:50:40", "ShutterSpeedValue": "1/1000", "ApertureValue": 4.0, ... }] |
(For… continue reading.