I like that it mimics SQL queries/filtering which is straightforward.
Typically I use something like JSONPath [1] (basically XPath for JSON) [2] or jq for this but having more options with other syntax and style is helpful.
For streamed JSON like NDJSON [3] there are some nice filtering options [4]
[1] https://en.wikipedia.org/wiki/JSONPath
[2] https://datatracker.ietf.org/doc/html/rfc9535
[3] https://github.com/ndjson/ndjson-spec
[4] https://github.com/mbostock/ndjson-cli?tab=readme-ov-file#fi...
Looks like .net Linq. Many js projects use lodash and variants, how do you compare that?
With JSON, sometimes you just need a fluent, permissive way to query objects that you don't already know a type structure for. This seems useful! I love JSONata for exploring json data, but it's more useful for static analysis than programming.
can a query like that be observable? so updating the array/object would cause the results to update?
Thanks. Looks really useful.
This is everything i wanted
For the same purpouse I ofter use this https://github.com/calmm-js/partial.lenses
There is another excellent write-up exploring the theory / use-cases for such libraries https://www.inkandswitch.com/cambria/ (and a corresponding library at https://github.com/inkandswitch/cambria-project)
In a similar vein is https://pbeshai.github.io/tidy/ which I've used for 3+ years. It's a really nice lightweight transformer.
I've also used https://github.com/uwdata/arquero once (better performance for large datasets).
[flagged]
[flagged]
Wouldn't the query for your example just be
data.filter(d => d.friends.includes("John")).map(d => ({name: d.name+" "+d.lastName}))
Maybe I'm missing the bigger picture, but that doesn't seem so bad