3 ms·
XPath, XSLT and XQuery are pretty awesome, in their special way. Although stringly-typed XPath has the same problems as SQL, building complex queries through s
by jimbokun 11y ago
XPath, XSLT and XQuery are pretty awesome, in their special way.
Although stringly-typed XPath has the same problems as SQL, building complex queries through string concatenation. This is where JSON shines, because you usually just convert to a tree of your language's native data structures in one line and use your languages native facilities to traverse it from there.
- andyjohnson0 11y agoIs there an equivalent of xpath for searching/traversing in-memory js object graphs?
- Chyzwar 11y 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 11y agoThere's JMESPath: http://jmespath.org/ http://jmespath.org/
- kisstheblade 11y agoJsonpath, eg. https://github.com/jayway/JsonPath https://github.com/jayway/JsonPath