I have a json file like below:
{ "result": { "covered_percent": 47.06 } }
and how can I read this value on Ubuntu Terminal.
Advertisement
Answer
You didn’t mention which version of ubuntu but as a 1 liner from the terminal this works for me (assumes json file is in same directory and called json_file.json)
python -c "import json;print json.loads(open('json_file.json', 'r').read())['result']['covered_percent']"