Show HN: JAQT – JavaScript Queries and Transformations

Poefke | 100 points

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

jansommer | 4 days ago

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...

drawkbox | 3 days ago

Looks like .net Linq. Many js projects use lodash and variants, how do you compare that?

ssahoo | 4 days ago

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.

csbbbb | 3 days ago
[deleted]
| 4 days ago

can a query like that be observable? so updating the array/object would cause the results to update?

gryzzly | 4 days ago

Thanks. Looks really useful.

kayo_20211030 | 4 days ago

This is everything i wanted

iddan | 4 days ago

For the same purpouse I ofter use this https://github.com/calmm-js/partial.lenses

fbn79 | 4 days ago

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)

e1g | 4 days ago

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).

porker | 4 days ago

[flagged]

FractalHQ | 4 days ago

[flagged]

waqasloper | 4 days ago