I appear to be struggling with cutting the JSON responses from CloudFlare's API.
when I CURL the https://api.cloudflare.com/client/v4/zones/xxxx/settings URL it returns all settings for the zone of my domain in a JSON response such as:
"editable": true,
"id": "server_side_exclude",
"modified_on": null,
"value": "on"
},
{
"editable": false,
"id": "sha1_support",
"modified_on": null,
"value": "off"
},
{
"editable": false,
"id": "sort_query_string_for_cache",
"modified_on": null,
"value": "off"
},
{
"certificate_status": "active",
"editable": true,
"id": "ssl",
"modified_on": "2016-05-18T14:38:45.665403Z",
"value": "flexible"
This is because I am of course cutting it by piping the curl to python -m json.tool. What I am trying to achieve is basically print everything as for example:
server_side_exclude = on
sha1_support = off
sort_query_string_for_cache = off
( the ID = the value ). I have attempted to store the IDs and values in separate variables as for example:
IDs=$(curl https://api.cloudflare.com/client/v4/zones/xxxx/settings | python -m json.tool | grep id)
Values=$(curl https://api.cloudflare.com/client/v4/zones/xxxx/settings | python -m json.tool | grep value)
and then printing them next to each other for example with:
echo "$IDs = $Values"
but the empty spaces appear to cause difficulties. I have also tried to cut the reply by using awk and sed but am not that familiar with the tools and had no success as well.
Could someone more familiar with cutting text assist me please. Thank you in advance.