I have a file outputted from an API, it contains a JSON.
{
"result": {
"id": "f34fdasdfaa4364adc42b3a57",
"modified_on": "2018-06-02T17:08:17.106435Z"
},
"success": true
}
I need only the value of id (in my case the f34fdasdfaa4364adc42b3a57)
I would do in bash:
#!/usr/bin/env bash
#Pseudocode
id=$(grep -Po '"id":.*?[^\\]",' id.txt)
# /Pseudocode
curl -X DELETE "https://www.example.com/delete/$id"
I did look for previous answer and got this: Parsing JSON with Unix tools
But the right answer extract key and value, I would only value (to no manipulate string anymore)
Thank you for your help