3 ms·
Is there an equivalent of xpath for searching/traversing in-memory js object graphs?
by andyjohnson0 10y ago
Is there an equivalent of xpath for searching/traversing in-memory js object graphs?
- Chyzwar 10y agoyou can use chained map/reduce. object.listOfItems .reduce((item) => item.type === 'car') .map((item) => item.name)); This is way more powerful than xpath.
- dschep 10y agoThere's JMESPath: http://jmespath.org/ http://jmespath.org/
- kisstheblade 10y agoJsonpath, eg. https://github.com/jayway/JsonPath https://github.com/jayway/JsonPath