Json token position library? #7
-
Hi, I'm searching for a API/library to get the position of a specific token in a json file. My goal would be to jump to it via command, so I need a "token to position" API. Anybody know if there is a builtin feature in VSCode or any good node library. Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I do not think we expose the low level tokens in API. So I believe this is not possible. |
Beta Was this translation helpful? Give feedback.
-
You'll need to parse an AST from the JSON source, like https://github.com/vtrushin/json-to-ast , which will have position information for each node. |
Beta Was this translation helpful? Give feedback.
-
Glad you found your answer! Closing... |
Beta Was this translation helpful? Give feedback.
You'll need to parse an AST from the JSON source, like https://github.com/vtrushin/json-to-ast , which will have position information for each node.