0

i've got a string with JSON text that i want to parse

heat@heat-G780 ~ $ data='{"foo": 42, "bar": "less interesting data"}'
heat@heat-G780 ~ $ echo $data|jq '.foo'
42

but then i can't assign this value to a variable

heat@heat-G780 ~ $ foo=$data|jq '.foo'
heat@heat-G780 ~ $ echo $foo
(here's nothing, trust me)

so, how can i assign it to a new variable?

0 Answers0