qeet / IMPORTJSONAPI

Use JSONPath to selectively extract data from any JSON or GraphQL API directly into Google Sheets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using match on all items in an array?

margorjon opened this issue · comments

Hello,

I'm trying to filter this data:

https://raw.githubusercontent.com/aEnigmatic/ffbe/master/skills_ability.json

And at first i tried with this function:
=IMPORTJSONAPI("https://raw.githubusercontent.com/aEnigmatic/ffbe/master/skills_ability.json","$.*.[?(@property==='name' && @.match('Gained'))]^","name,effects[0],effects[1],effects[2],effects[3],effects[4],effects[5]")

Which works well, but how would i go about filter in the effects column? I want to find results containing "9999" in any of the effects columns? I tried
"$.*.[?(@property==='effects' && @.match('9999'))]^"
"$.*.[?(@property==='effects[0]' && @.match('9999'))]^"
"$.*.[?(@property==='effects[*]' && @.match('9999'))]^"

To no avail, and then i ran out of ideas... is it possible to do what i want?

commented

Is this any good?

=IMPORTJSONAPI("https://raw.githubusercontent.com/aEnigmatic/ffbe/master/skills_ability.json","$.*.effects.*[?(@.match('9999'))]", "^^^name, @")

Thank you very much! That worked perfect!