How can I fetch the value of a key-value pair in a JSON using shell script I do not know the positions of key-value pairs in the JSON, I will have to search and get the value of the key-value pair.
{
"firstName": "Rajesh",
"lastName": "Kumar",
"gender": "man",
"age": 24,
"address": {
"streetAddress": "126 Udhna",
"city": "Surat",
"state": "GJ",
"postalCode": "394221",
"state": "WB"
},
"phoneNumbers": [
{ "type": "home", "number": "7383627627" }
]
}
Sample JSON. I will have to fetch the value of the city and I do not know the position of it as I will have to search and fetch the value.