Please help with json_query filter

Hi everybody!

I have a JSON structure like this:

raw_list= [
{ content: [
{ name: name1, prop: val1},
{ name: name2, prop: val2}
]},
{ content: [
{ name: name3, prop: val3}
]}
]

and I need to get from this arrays of names like this:

[ [name1, name2], [name3] ]

How can I achieve that?

If I leave only one element of the initial array, then I can filter it using

json_query(content[*].name)

I get one array ([name1, name2]), but I need an array of arrays. I tried to use

json_query([].content[].name)

but it doesn’t work, I get ampty variable

I would really appritiate any help!!!

Best Regards,
Ivan

Not sure about your specific issue, but I noticed that the JMESPath examples page http://jmespath.org/examples.html is actually dynamic, so you can paste in your own json structures and test them out - hope that helps,

Jon

I think you can get this with the map filter pretty easy also:

raw_list|map(attribute=‘content’)|map(attribute=‘name’)|list