I am writing a frontend application that will provide a UI enabling users to make certain filter selections. We are creating a data visualization that will be populated by data objects fitting the user's filter criteria. For example, user might say:
Show me all data objects that have the emails
[email protected],[email protected], or[email protected], but only if those objects also have tagsAandBassociated with them.
We could represent this in SQL:
SELECT * from dataPoints
WHERE userEmail in ("[email protected]", "[email protected]", "[email protected]")
...
I'm wondering how to best codify this in JSON so that a frontend user can save a filter. We want to store "JSON that represents the user's selections" in a database, retrieve the filter JSON from the database, and apply it to JSON data (i.e. filtering happens in the browser).
I think I can represent query instructions in JSON, something like how it's done here, but I'm wondering... is this not a solved problem? Are there approaches for codifying user filter selections in JSON and for performing client-side filtering?
And to be clear: I'm less concerned with how to apply filter logic to JSON data, and more about "how to represent a user's query preferences in a JSON object." Once I decide how to represent the filter, I can translate that into functions that iterate over JSON data. The other suggested answers are more about how to query JSON. I need to store the query instructions in JSON.
you can use JSON to send array and inner join on it to filter. in example i created some data because you did not provided any.
output: as you see, A@... did not show up , since its not matching