I am new to jq and am encountering a problem while parsing my json
I have json stored in a variable like this
temp='{ "1": { "my_name": "one" }, "2": { "my_name": "two" } }'
Now I need to get the value my_name for both other entries
I tried something like this
echo $temp | jq '.1' //out put 0.1 I was assuming to get { "my_name": "one" }
And similarly, to get the value of my_name, I did
echo $temp | jq '.1.my_name' // Its output is giving me error
Can anyone help determine what is wrong with my syntax and how can I fix it.
thanks
source share