vim-jsonpath icon indicating copy to clipboard operation
vim-jsonpath copied to clipboard

Support for Well-Known Path Notations

Open odnoletkov opened this issue 7 years ago • 1 comments

I am aware of a few relatively well-known ways to define paths in JSON:

It would be great to support/be based on one of them to be interoperable with other tools. The last one is particularly interesting since it is used in JSON Schema.

odnoletkov avatar Jul 13 '18 17:07 odnoletkov

I looked at JSONPath when creating this plugin, but thought that most of its features (selection/filtering) are better realised using jq.

Allowing path[1].prop and path['path.with dots'] in addition to path.1.prop is easy enough to implement, but my initial thought was to skip it unless there's demand for it. I might end up adding it in the next release if someone finds it useful :)

Using the JSON Pointer syntax should be possible already by changing g:jsonpath_delimeter when desired:

let g:jsonpath_delimeter = '/'

Implementing Relative JSON Pointers requires backtracking unless I'm mistaken - which, while it would be nice, might not be worth the additional complexity/scanning time. Not sure about it's usefulness while editing JSON schemas since the example in this SA question shows that the 1/password reference appears to point to what this plugin would consider being 3/password.

mogelbrod avatar Jul 16 '18 17:07 mogelbrod