{"id":16126481,"url":"https://github.com/dsc/jsongrep","last_synced_at":"2025-09-07T20:07:32.452Z","repository":{"id":768537,"uuid":"451136","full_name":"dsc/jsongrep","owner":"dsc","description":"A shell tool to search and select bits out of a JSON document.","archived":false,"fork":false,"pushed_at":"2020-07-20T00:51:58.000Z","size":25,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-26T13:30:33.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dsc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-12-28T15:48:17.000Z","updated_at":"2024-06-23T14:53:11.000Z","dependencies_parsed_at":"2022-08-16T10:50:20.604Z","dependency_job_id":null,"html_url":"https://github.com/dsc/jsongrep","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dsc/jsongrep","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsc%2Fjsongrep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsc%2Fjsongrep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsc%2Fjsongrep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsc%2Fjsongrep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dsc","download_url":"https://codeload.github.com/dsc/jsongrep/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsc%2Fjsongrep/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274088625,"owners_count":25220260,"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","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-09T21:39:04.487Z","updated_at":"2025-09-07T20:07:32.426Z","avatar_url":"https://github.com/dsc.png","language":"Python","funding_links":[],"categories":["\u003ca name=\"data-management-json\"\u003e\u003c/a\u003eData management - JSON/YAML/etc."],"sub_categories":[],"readme":"# jsongrep - A shell tool to search and select bits out of JSON documents.\n\njsongrep is a shell tool for extracting values from [JSON](http://json.org) documents. It supports shell-like globbing for property names, and emits the matched values separated by newlines.\n\n\n## Examples\n\nLet's start with a real-world example.\n\nLet's grab the even tweets from the last 10 pulled from [Twitter's JSON feed](http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-public_timeline):\n\n    $ curl -s 'http://twitter.com/statuses/public_timeline.json' | jsongrep '[02468].text'\n    それでｒはみなさｌあごきげんよい\n    ARGHHHHHH. facebook is being incompetent like Trump\n    5-5 in the darts between Barney and Whitlock. Amazing. #darts\n    I wonder if I'm still located on 5th ave?\n    Estou de volta  a internet .... Essa chuva ñ para !   Estou de boa com a minha familia .\n\nYeah, that's just about what I expected.\n\nNow suppose you have a JSON document like the one in `tests/ongz.json` which looks like this:\n\n    {\n        \"bah\" : {\n            \"feh\" : true,\n            \"foo\" : 3,\n            \"lah\" : \"songz\"\n        },\n        \"blah\" : {\n            \"lol\" : \"gongz\"\n        },\n        \"arr\" : [\n            \"a\", \"b\", \"c\", \"d\", \"e\", \n            \"f\", \"g\", \"h\", \"i\", \"j\", \n            \"k\", \"l\", \"m\", \"n\", \"o\", \n            \"p\", \"q\", \"r\", \"s\", \"t\", \n            \"u\", \"v\", \"w\", \"x\", \"y\", \n            \"z\"\n        ]\n    }\n\njsongrep will let you match structural patterns, where `.` (dot) separates nested properties. \n\nLet's glob on property names:\n\n    $ jsongrep 'b*.l*' tests/ongz.json\n    gongz\n    songz\n\nWorks on arrays, too:\n\n    $ jsongrep 'arr.?' tests/ongz.json\n    a\n    b\n    c\n    d\n    e\n    f\n    g\n    h\n    i\n    j\n\nNote that we're still globbing, even though arrays have numeric indices:\n\n    $ jsongrep 'arr.2?' tests/ongz.json\n    u\n    v\n    w\n    x\n    y\n    z\n\nIf you specify a JSON subtree, that's what you get back.\n\n    $ jsongrep 'bah' tests/ongz.json \n    {\"foo\": 3, \"lah\": \"songz\", \"feh\": true}\n\n\n## Syntax\n\njsongrep currently supports normal shell glob patterns within property names:\n\n    ?       Matches any one character\n    *       Matches any number of characters within a field\n    [seq]   Matches any of the characters in seq\n    [!seq]  Matches any of the characters not in seq\n\nDot is the field separator.\n\n\n## Installation\n\njsongrep requires Python \u003e= 2.6. To install:\n\n    $ git clone git://github.com/dsc/jsongrep.git\n    $ cd jsongrep\n    $ python setup.py install\n\nThe easiest way is to use [pip](http://pip.openplans.org/):\n\n    $ pip install -e git://github.com/dsc/jsongrep.git#egg=jsongrep\n\nIf you prefer `easy_install`:\n\n    $ git clone git://github.com/dsc/jsongrep.git\n    $ easy_install jsongrep\n\nAll of these options will fetch the dependencies and install the script.\n\n\n## Usage\n\n    Usage: jsongrep [options] [PATTERN | -e PATTERN [-e PATTERN ...]] [FILE]\n\n    Parses JSON data structurally to select a subset of data.\n\n    Options:\n      --version             show program's version number and exit\n      -h, --help            show this help message and exit\n      -e PATTERNS, --pattern=PATTERNS\n                            Additional patterns to match.\n      -D, --detect-encoding\n                            Attempts to detect the character encoding of input if\n                            LC_TYPE and file.encoding provide insufficient hints.\n                            (Slow) [default: False]\n\n\n## TODO\n\n * Support star-star (`**`) non-greedy matches of spanning subgraphs\n * Support unicode, escapes in patterns\n * Support extended regexps\n * Support no-pattern-matching lookup\n * Options:\n    * Property separator in patterns (. by default)\n    * Output separator (newline by default)\n    * Quote string values in output?\n    * 1/0 vs true/false for bool values in output?\n\n\n## Feedback\n\nOpen a ticket on [github](http://github.com/dsc/jsongrep), or send me an email at [dsc@less.ly](mailto:dsc@less.ly).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsc%2Fjsongrep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdsc%2Fjsongrep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsc%2Fjsongrep/lists"}