Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show JSON path #310

Open
zmorris opened this issue Apr 27, 2018 · 2 comments
Open

Show JSON path #310

zmorris opened this issue Apr 27, 2018 · 2 comments

Comments

@zmorris
Copy link

zmorris commented Apr 27, 2018

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
Copy link
Owner

fkling commented May 17, 2018

Good idea 😃

@0xdevalias
Copy link

0xdevalias commented Jul 10, 2023

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:

  • https://eslint.org/docs/latest/extend/selectors
    • A selector is a string that can be used to match nodes in an Abstract Syntax Tree (AST).
      This is useful for describing a particular syntax pattern in your code.

      The syntax for AST selectors is similar to the syntax for CSS selectors. If you’ve used CSS selectors before, the syntax for AST selectors should be easy to understand.

Also potentially tangentially related:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants