{"id":19213565,"url":"https://github.com/karimsa/json","last_synced_at":"2026-04-18T12:02:29.132Z","repository":{"id":57639662,"uuid":"116440802","full_name":"karimsa/json","owner":"karimsa","description":"Parse JSON objects from shell scripts.","archived":false,"fork":false,"pushed_at":"2018-01-06T01:01:23.000Z","size":817,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-14T12:03:29.577Z","etag":null,"topics":["go","json","parser","shell"],"latest_commit_sha":null,"homepage":"","language":"Go","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/karimsa.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":"2018-01-06T00:35:28.000Z","updated_at":"2018-01-06T00:51:13.000Z","dependencies_parsed_at":"2022-08-27T19:52:23.488Z","dependency_job_id":null,"html_url":"https://github.com/karimsa/json","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/karimsa/json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karimsa%2Fjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karimsa%2Fjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karimsa%2Fjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karimsa%2Fjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karimsa","download_url":"https://codeload.github.com/karimsa/json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karimsa%2Fjson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31967993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"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":["go","json","parser","shell"],"created_at":"2024-11-09T14:06:21.411Z","updated_at":"2026-04-18T12:02:29.097Z","avatar_url":"https://github.com/karimsa.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json\n\nParse JSON objects from shell scripts.\n\n**Install**: `go get -u github.com/karimsa/json`\n\n## Usage\n\nTo read a json file from the shell, just pipe it to the json command and eval the result.\n\n```shell\n$ cat sample_file.json\n{\n  \"message\": \"hello world\"\n}\n$ eval \"$(json \u003c sample_file.json)\"\n$ echo ${message}\nhello world\n```\n\nTo scope all keys to a given key, pass that key as a parameter to json.\n\n```shell\n$ cat sample_file.json\n{\n  \"message\": \"hello world\"\n}\n$ eval \"$(json obj \u003c sample_file.json)\"\n$ echo ${obj_message}\nhello world\n```\n\nObject paths use `_` instead of `.` - so `path.to.key` becomes `path_to_key`.\n\nArrays are a bit weird though. My goal was to keep this utility POSIX compliant so it is\nas universal as possible. The element index will be a suffix to the variable. To retrieve\nthe value dynamically, you need to use a bit of `eval` hacking. Here's a pretty function that\ncan do it for you:\n\n```shell\nfunction at () {\n  echo \"$(eval echo \"\\${${1}_${2}${3}}\")\"\n}\n```\n\nFor a more complete example, see [this](example/test.sh).\n\n## License\n\nLicensed under MIT license.\n\nCopyright (C) 2017-present Karim Alibhai.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarimsa%2Fjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarimsa%2Fjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarimsa%2Fjson/lists"}