{"id":26160700,"url":"https://github.com/ficolas2/jgrep","last_synced_at":"2026-04-21T12:02:26.767Z","repository":{"id":281102548,"uuid":"944014591","full_name":"ficolas2/jgrep","owner":"ficolas2","description":"Jrep is a mix between grep and jq. Look for partial text, and wildcard matches in JSON files.  Because jq forces you to know the entire path, and grep makes the match lose its JSON context. Jrep keeps the best of both worlds","archived":false,"fork":false,"pushed_at":"2025-03-09T18:43:04.000Z","size":202,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T18:45:40.743Z","etag":null,"topics":["cli","command-line","commands","grep","jq","json","utilities"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ficolas2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-03-06T16:35:34.000Z","updated_at":"2025-03-09T18:43:08.000Z","dependencies_parsed_at":"2025-03-07T02:24:37.229Z","dependency_job_id":"89ef3dce-1137-4fd3-a0f6-95522d7d8e7f","html_url":"https://github.com/ficolas2/jgrep","commit_stats":null,"previous_names":["ficolas2/jrep","ficolas2/jgrep"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ficolas2%2Fjgrep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ficolas2%2Fjgrep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ficolas2%2Fjgrep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ficolas2%2Fjgrep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ficolas2","download_url":"https://codeload.github.com/ficolas2/jgrep/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243030820,"owners_count":20224667,"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":["cli","command-line","commands","grep","jq","json","utilities"],"created_at":"2025-03-11T12:19:20.360Z","updated_at":"2026-04-21T12:02:26.759Z","avatar_url":"https://github.com/ficolas2.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jgrep\n\nA mix between grep and jq\n\nLook for partial text, and wildcard matches in JSON files.\n\nBecause jq forces you to know the entire path, and grep makes the match lose its JSON context.\n\n⚠️ The query language is experimental, and bound to change. ⚠️\n\nIf you want to make suggestions, discussion is welcomed in the issues\n\n\n- [Installation](#Installation)\n- [Usage](#Usage)\n  - [Query language](#Query-language)\n  - [Flags](#Flags)\n    - [Displaying JSON instead of the path](#Displaying-JSON-instead-of-the-path)\n    - [Context](#Context)\n\n![Image](image.png)\n\n## Installation\nYou need cargo to install jgrep. If you don't have it, you can install it with rustup\n\nTo install jgrep, just run\n```bash\ncargo install jgrep\n```\n\n\n## Usage\nWe will use the following JSON for all the examples:\n```json\n{\n  \"items\": [\n    {\n      \"id\": 1,\n      \"name\": \"Lorem\",\n      \"active\": true,\n      \"meta\": {\n        \"rating\": 4.7,\n        \"author\": { \"name\": \"John\", \"verified\": false }\n      }\n    },\n    {\n      \"id\": 2,\n      \"name\": \"Ipsum\",\n      \"active\": false,\n      \"meta\": {\n        \"rating\": 3.9,\n        \"author\": { \"name\": \"Jane\", \"verified\": true }\n      }\n    }\n  ]\n}\n```\n\n### Query language\nJgrep uses a very simple query language, based on the JSON path syntax, and admitting wildcards (* and ?) for keys and values.\nIt allows using the typical JSONPath constructs, like `$.key`, or `$.key..key`, but also admits a simple syntax allowing for partial matches, recursive searches, wildcards and more.\n\u003c!-- Test: query_lang_simple --\u003e\n```bash\njgrep 'Jane' filename\n#\u003e .items[1].meta.author.name: \"Jane\"\n```\n\nWill look for all the occurrences of 'Jane', in keys or values, and it will return the path to it.\n\nYou can also look for keys only, by putting the keys before a colon (:), or starting it with a dot (.):\nIn contrast to JSONPath, the dot by itself, does not assert the start of the match at the root of the JSON, but at any level.\n\u003c!-- Test: query_lang_keys --\u003e\n```bash\njgrep 'author:' filename\n# or\njgrep '.meta.author' filename\n#\u003e .items[0].meta.author: { \n#\u003e   \"name\": \"John\", \n#\u003e   \"verified\": false \n#\u003e }\n#\u003e .items[1].meta.author: {\n#\u003e   \"name\": \"Jane\",\n#\u003e   \"verified\": true \n#\u003e }\n```\n\nOr for values only, by putting the value after a colon:\n\u003c!-- Test: query_lang_values --\u003e\n```bash\njgrep ': true' filename\n#\u003e .items[0].active: true\n#\u003e .items[1].meta.author.verified: true\n```\n\nOr for values and keys, having the key before a colon and the value after it:\n\u003c!-- Test: query_lang_values_and_keys --\u003e\n```bash\njgrep '.rating: 4.7' filename\n#\u003e .items[0].meta.rating: 4.7\n```\n\nAnd you can use wildcards:\n\u003c!-- Test: query_lang_wildcard --\u003e\n```bash\njgrep '.name: J*n*' filename\n#\u003e .items[0].meta.author.name: \"John\"\n#\u003e .items[1].meta.author.name: \"Jane\"\njgrep '.name: Jan?' filename\n#\u003e .items[1].meta.author.name: \"Jane\"\n```\n\nWildcards work with numbers too:\n\u003c!-- Test: query_lang_wildcard_number --\u003e\n```bash\njgrep '.rating: 4.*' filename\n#\u003e .items[0].meta.rating: 4.7\n```\n\n### Flags\n#### Displaying only the match\nPrints just the matching key, value, or key-value pair. Useful for piping or processing the raw matched data.\n\u003c!-- Test: flags_only --\u003e\n```bash\njgrep '.author' filename -o\n#\u003e {\"name\":\"John\",\"verified\":false}\n#\u003e {\"name\":\"Jane\",\"verified\":true}\n```\n\n#### Displaying JSON instead of the path\nIf you want to see the whole matched json, not just the path to the matched part, use the ``--json`` (``-j``) flag.\nThe path to the current match will be displayed in a different color, if the terminal supports it.\n\u003c!-- Test: flags_json --\u003e\n```bash\njgrep '.rating' filename -j\n#\u003e {\n#\u003e   \"items\": [\n#\u003e     {\n#\u003e       \"meta\": {\n#\u003e         \"rating\": 4.7\n#\u003e       }\n#\u003e     },\n#\u003e     {\n#\u003e       \"meta\": {\n#\u003e         \"rating\": 3.9\n#\u003e       }\n#\u003e     },\n#\u003e   ]\n#\u003e }\n```\n\n#### Context\nLike for grep, ``--context`` (``-C``) displays information around the match. In jgrep, each context prints one previous level of the JSON object.\nThe path to the current match will be displayed in a different color, if the terminal supports it.\n\u003c!-- Test: context --\u003e\n```bash\njgrep 'Jane' filename -C 1\n#\u003e .items[1].meta.author: {\"name\":\"Jane\",\"verified\":true}\n```\n\nAlso works with the ``-json`` (``-j``) flag, increasing the context level:\n\u003c!-- Test: context_json --\u003e\n```bash\njgrep \"Jane\" filename -C 2 -j\n#\u003e {\n#\u003e   \"items\": [\n#\u003e     {\n#\u003e       \"meta\": {\n#\u003e         \"rating\": 3.9,\n#\u003e         \"author\": {\n#\u003e           \"name\": \"Jane\",\n#\u003e           \"verified\": true\n#\u003e         }\n#\u003e       }\n#\u003e     },\n#\u003e   ]\n#\u003e }\n```\n\nIn comparison to no context:\n\u003c!-- Test: no_context_json --\u003e\n```bash\njgrep \"Jane\" filename -j\n#\u003e {\n#\u003e   \"items\": [\n#\u003e     {\n#\u003e       \"meta\": {\n#\u003e         \"author\": {\n#\u003e           \"name\": \"Jane\"\n#\u003e         }\n#\u003e       }\n#\u003e     },\n#\u003e   ]\n#\u003e }\n```\nIt increases the JSON printed two levels backwards (in this case, with ``-C 2``)\n\n\u003c!-- #### Ignore case --\u003e\n\u003c!-- You can use the ``--ignore-case`` (``-i``) flag to ignore the case of the query. --\u003e\n\u003c!-- ```bash --\u003e\n\u003c!-- jgrep 'jane' filename -i --\u003e\n\u003c!-- #\u003e .items[1].meta.author.name: \"Jane\" --\u003e\n\u003c!-- ``` --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fficolas2%2Fjgrep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fficolas2%2Fjgrep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fficolas2%2Fjgrep/lists"}