{"id":16115253,"url":"https://github.com/pvande/jason","last_synced_at":"2025-04-14T03:34:08.648Z","repository":{"id":2529244,"uuid":"3505735","full_name":"pvande/jason","owner":"pvande","description":"A Quick JSON Processor -- in Bash","archived":false,"fork":false,"pushed_at":"2012-02-27T00:24:39.000Z","size":108,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T17:36:42.273Z","etag":null,"topics":["bash","json-parser","shell"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/pvande.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}},"created_at":"2012-02-21T16:37:57.000Z","updated_at":"2023-08-21T07:42:50.000Z","dependencies_parsed_at":"2022-08-28T06:03:14.169Z","dependency_job_id":null,"html_url":"https://github.com/pvande/jason","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/pvande%2Fjason","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvande%2Fjason/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvande%2Fjason/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvande%2Fjason/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pvande","download_url":"https://codeload.github.com/pvande/jason/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248815832,"owners_count":21165985,"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":["bash","json-parser","shell"],"created_at":"2024-10-09T20:18:15.764Z","updated_at":"2025-04-14T03:34:08.628Z","avatar_url":"https://github.com/pvande.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Jason\n\n### What\n\nA command-line JSON parser written entirely in Bash (v3).\n\n### Why\n\nTo provide a portable JSON parser for use as a part of a shell pipeline.\n\n### How\n\n``` bash\n$ json='{ \"users\": [ { \"name\": \"Amy\", \"age\": 12 }, { \"name\": \"Bill\", \"age\": 42 } ] }'\n\n# By default, Jason prints every key and value (tab separated) in a depth-first\n# post-traversal order.\n$ echo $json | jason\nthis[\"users\"][0][\"name\"]\t\"Amy\"\nthis[\"users\"][0][\"age\"]\t12\nthis[\"users\"][0]\t{ \"name\": \"Amy\", \"age\": 12 }\nthis[\"users\"][1][\"name\"]\t\"Bill\"\nthis[\"users\"][1][\"age\"]\t42\nthis[\"users\"][1]\t{ \"name\": \"Bill\", \"age\": 42 }\nthis[\"users\"]\t[ { \"name\": \"Amy\", \"age\": 12 }, { \"name\": \"Bill\", \"age\": 42 } ]\nthis\t{ \"users\": [ { \"name\": \"Amy\", \"age\": 12 }, { \"name\": \"Bill\", \"age\": 42 } ] }\n\n# Jason can also accept a search path, which will limit the output to only keys\n# matching the given keypath.\n$ echo $json | jason this.users\nthis[\"users\"]\t[ { \"name\": \"Amy\", \"age\": 12 }, { \"name\": \"Bill\", \"age\": 42 } ]\n\n# Jason is reasonably flexible about the form of your keypath.\n$ echo $json | jason users\nthis[\"users\"]\t[ { \"name\": \"Amy\", \"age\": 12 }, { \"name\": \"Bill\", \"age\": 42 } ]\n$ echo $json | jason 'this[\"users\"]'\nthis[\"users\"]\t[ { \"name\": \"Amy\", \"age\": 12 }, { \"name\": \"Bill\", \"age\": 42 } ]\n\n# The ':' operator lets you quickly map over arrays and hashes.\n$ echo $json | jason users:name\nthis[\"users\"][0][\"name\"]\t\"Amy\"\nthis[\"users\"][1][\"name\"]\t\"Bill\"\n\n# For more control, an asterisk can stand in for any part of the keypath.\n$ echo $json | jason 'users[*][*]'\nthis[\"users\"][0][\"name\"]\t\"Amy\"\nthis[\"users\"][0][\"age\"]\t12\nthis[\"users\"][1][\"name\"]\t\"Bill\"\nthis[\"users\"][1][\"age\"]\t42\n\n# The root element is always referred to as 'this', so you always have the tools\n# you need to effectively process (and reprocess) JSON.\n$ echo $json | jason this.users | cut -f 2 | jason this:age | cut -f 2\n12\n42\n```\n\n### Why not?\n\n* It can be very slow on moderately large JSON structures.\n* Search keypaths are bound to be a little fragile, and are unlikely to handle\n  keys with escapes well.\n* It may parse invalid JSON erroneously.\n* Debugging can be a pain.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvande%2Fjason","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpvande%2Fjason","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvande%2Fjason/lists"}