I am trying to loads and print JSON response in shell script.I dont have any idea how to achieve this.Please help me on this.
Code:
#!/bin/sh
malop_q=$(curl -X GET -k -H "SEC: xxxxxxxxxxxxxxxxxxxxxx" 'https://127.0.0.1/api/reference_data/sets/malopid?fields=data(value)')
echo $malop_q
JSON Response:
{"data":[{"value":"11.945403842773683082"},{"value":"11.945403842773683082"},{"value":"11.945403842773683082"}]}
Expected OP is
I need to print values from above JSON response is:
11.945403842773683082
11.945403842773683082
11.945403842773683082
Thanks in advance.
'
jq. Using text processing tools (likeawk) for parsingjsonis never the best idea. Use a tool that hasjsonparsing libraries.