{"id":16103186,"url":"https://github.com/icyflame/json-where","last_synced_at":"2026-05-15T08:02:42.438Z","repository":{"id":150350402,"uuid":"210294586","full_name":"icyflame/json-where","owner":"icyflame","description":"Where are you inside a JSON file?","archived":false,"fork":false,"pushed_at":"2020-01-23T13:27:44.000Z","size":426,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-12T07:31:44.900Z","etag":null,"topics":["editor-plugin","json","json-path","vim-plugin"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icyflame.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-23T07:45:08.000Z","updated_at":"2020-01-23T13:27:46.000Z","dependencies_parsed_at":"2023-07-27T07:00:34.479Z","dependency_job_id":null,"html_url":"https://github.com/icyflame/json-where","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icyflame%2Fjson-where","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icyflame%2Fjson-where/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icyflame%2Fjson-where/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icyflame%2Fjson-where/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icyflame","download_url":"https://codeload.github.com/icyflame/json-where/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247422479,"owners_count":20936483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["editor-plugin","json","json-path","vim-plugin"],"created_at":"2024-10-09T18:56:14.889Z","updated_at":"2026-05-15T08:02:37.402Z","avatar_url":"https://github.com/icyflame.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-where\n\n\u003e Where are you inside a JSON file?\n\n[![asciicast](https://asciinema.org/a/295553.svg)](https://asciinema.org/a/295553)\n\n**Note:** I place the cursor on various keys in the JSON file and then type the\nmapping `\u003cleader\u003ejw`, which invokes the `JsonWhere()` vim function, which in\nturn invokes the json-where executable. You can look at the bottom left corner\nof the video to see the JSON path being printed to the screen.\n\n## Contents\n\n- [Usage][4]\n    - [Command line][5]\n    - [Vim][6]\n- [Compile from source][1]\n- [Credits][8]\n- [TODO][15]\n- [License][9]\n\n## Usage\n\n`json-where` can be used from the command line. You can also set it up to run\nusing a keybinding inside the editor of your choice.\n\n### Command line\n\n```sh\n# json-where file-name line column\n$ json-where test.json 250  14\n.[5].tags[3]\n```\n\n### Vim\n\nAfter installing json-where, you can use this function to invoke it based on\nyour cursor position from within vim.\n\n```vim\nfunction JsonWhere()\n    if executable(\"json-where\") == 0\n        return 'ERROR: json-where not found'\n    endif\n\n    let cursor = getcurpos()\n    let lnum = cursor[1]\n    let colnum = cursor[2]\n\n    let filename = expand('%:p')\n    if len(filename) == 0\n        let filename = tempname() + \".json\"\n        silent exe(\"write! \" . filename)\n        silent exe(\"edit \" . filename)\n    endif\n\n    let cmd_list = [ ]\n    let cmd_list += [ 'json-where' ]\n    let cmd_list += [ filename ]\n    let cmd_list += [ lnum ]\n    let cmd_list += [ colnum ]\n\n    let cmd = join(cmd_list, ' ')\n    let json_where_output = systemlist(cmd)\n\n    if len(json_where_output) \u003e 0\n        return json_where_output[len(json_where_output)-1]\n    else\n        return 'ERROR: json-where output is invalid'\n    endif\nendfunction\n```\n\nYou can attach a keybinding to this function in normal mode:\n\n```vim\nnmap \u003cleader\u003ejw :echo JsonWhere()\u003ccr\u003e\n```\n\n**Note:** For best results, call JsonWhere with the cursor on the first\ncharacter in the JSON key or value.\n\n## Compile from source\n\njson-where is a C++11 program. It can be compiled and installed using the\nstandard GNU program compile process:\n\n```sh\n$ ./configure\n$ make\n$ sudo make install\n```\n\nWhen this repository is cloned, the configure script will be missing. You can\ncreate it by running the [`autogen.sh`][3] script.\n\nBy default, these commands will install the executable `json-where` inside\n`/usr/local/bin/`. You can change the destination by running the configure\nscript with the `--prefix` option. Other options that you can pass to the\nconfigure script can be found on the [autoconf manual][2].\n\n## Credits\n\n- [`giacomodrago/minijson_reader`][10]\n- [Using GNU autotools to distribute C++ programs][14]\n\n## TODO\n\n- [ ] Move the Vim function in this readme to it's own Vim plugin\n- [ ] Man page\n\n## License\n\n`minijson_reader`'s LICENSE is included [here][11] and appended to the\n[LICENSE][12] notice at the root of this repository.\n\nEverything else in this repository is licensed under the MIT license.\n\nCopyright (C) 2019 Siddharth Kannan \u003cmail@siddharthkannan.in\u003e\n\n[1]: #compile-from-source\n[2]: https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/autoconf.html#Installation-Names\n[3]: ./autogen.sh\n[4]: #usage\n[5]: #command-line\n[6]: #vim\n[7]: #install\n[8]: #credits\n[9]: #license\n[10]: https://github.com/giacomodrago/minijson_reader\n[11]: ./src/nested_json/minijson/LICENSE.txt\n[12]: ./LICENSE\n[13]: ./img/screenshot.png\n[14]: https://digitalleaves.com/blog/2017/12/build-cross-platform-c-project-autotools/\n[15]: #todo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficyflame%2Fjson-where","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficyflame%2Fjson-where","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficyflame%2Fjson-where/lists"}