fkling / astexplorer

A web tool to explore the ASTs generated by various parsers.
https://astexplorer.net/
MIT License
6.16k stars 733 forks source link

Show JSON path #310

Open zmorris opened 6 years ago

zmorris commented 6 years ago

Hi AST Explorer is fantastic but trying to keep all the nodes straight in my head is darn near impossible. Could you add a status field somewhere that shows the JSON path to the currently selected element, something like http://jsonpathfinder.com/ ?

Also it would be really fantastic to be able to enter a JSON path and have it select/highlight that node. I realize this is a little complex though so just showing the path would provide most of the functionality I need.

Oh and as far as JSON path string standards on this go, JSONPath.stringify() works ok. Otherwise you could just show the path in bracket form ['some']['path']['here'] and use JSON.stringify() to quote each node's name for display between the brackets.

Thanks for your hard work so far!

fkling commented 6 years ago

Good idea 😃

0xdevalias commented 1 year ago

I'd also be interested in being able to see/copy an esquery style path/selector, which could be very cool/useful:

I believer eslint also uses esquery for it's selectors, which are documented here:

Also potentially tangentially related: