Extract Data From Json String

Jan 8, 2019 / Updated on Jan 8, 2019

myjson='{"somekey":"someval"}'

v=`echo $myjson | jq '.somekey'`
echo $v

output: "someval"

# Get the value wihout quotes
v=`echo $myjson | jq -r '.somekey'`
echo $v

output: someval



comments powered by Disqus
Categories:
Tags: