I need to accurately grab a single value out of a JSON data structure Curl'd from an api using the tools that are natively available on an Amazon Linux EC2 instance (Python and CURL) are there by default so I don't have fly anything in via yum/github/curl. The value in question is going to be used for an Amazon User data script to uniquely identify servers in a cluster so compactness is important.
eg:
curl https://superdooperapi.io/get-me-an-id
Will return
{ "id": 12398990, "date": "2015-01-10" }
I just need the single numeric value for id
so I can use it in a shell script. I could use grep/sed/awk but that just seems messy.
It's easy to do writing a full python script to execute, but I'd like an elegant single line solution that I can use in a startup script.