This is a very simple (maybe stupid) question, but I can't get it to work ...
I have a json file with this structure
{ "data": { "what a burger": [1,2,3], "wap": [66], "the map": [11,20], "H. Incandenza": [1,1], "What a burger": [a,a,3] } }
and I would like to extract the values of the fields inside the data whose "name" matches a specific pattern. For example, I would like to extract all the case insensitive matches “what is a hamburger” to get
[1,2,3], [a, a, 3]
My guess would be like
jq '.data | match("what a burger";"i")'
but it leads to
jq: error (at <stdin>:9): object ({"what a bu...) cannot be matched, as it is not a string
Greetings.
source share