I am trying to make a little script in shellscript that takes one serviceUuid from a response and use it. I just print the server response on a file called final.txt Now i need to extract the value after "serviceUuid":"
This is the script:
uuid=$(curl -X POST -H "ACCEPT-LANGUAGE:en" -H "Content-Type: application/json" -H "Accept: application/json" -d {"username":"HereThereIsTheUsername"} Here there is the url )
echo $uuid >> final.txt
this is the response:
{"status":{"code":"STATUS_OK","message":"ServiceUUID sent successfully via..."},"body":{"data":{"userApps":{},"username":"HereTheUsername","fullName":"NameOfTheAccountPossessor","lang":"sq","blocked":false,"lastLogin":"2016-10-10T17:19:22","passwordResetUuid":"6147dc32-b72e-450a-8084-2fdb5319a931","userAccessLevel":5,"countDownSeconds":0,"serviceUuid":"7260276c-5c3f-41d3-9329-3603acecb7e5","userAttributes":{},"labelMap":{},"id":"APPUSER00000012","someLabel":"NameOfTheOrganisation"}}}
So can someone help me to extract the value?
echo "$uuid"
instead ofecho $uuid
? The whitespace is important if you're going to try and parse JSON from shell. (Remember to edit this into your question and format it with the{}
button...)