bash - Json Parsing using shell script -



bash - Json Parsing using shell script -

this question has reply here:

parsing json unix tools 33 answers

after doing curl query getting output in format shown below:

{"result":[]} {"result":[{"alternative":[{"transcript":"good morning how feeling today"}, {"transcript":"good morning go how feeling today"}, {"transcript":"good morning 2 go how feeling today"}, {"transcript":"good morning how feeling"}, {"transcript":"good morning how today"}],"final":true}], "result_index":0}

i want retrieve "good morning how feeling today" first transcript.

please tell me how it? thanks!

piping curl next emit string in question if have jq installed:

jq -r '.result[0].alternative[0].transcript' | egrep -v '^null$' | head -n 1

json bash shell scripting

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -