{"id":38864731,"url":"https://github.com/ctomkow/jsonparse","last_synced_at":"2026-01-17T14:24:34.099Z","repository":{"id":58765661,"uuid":"153364594","full_name":"ctomkow/jsonparse","owner":"ctomkow","description":"A simple JSON key parse library","archived":false,"fork":false,"pushed_at":"2024-11-05T05:22:38.000Z","size":745,"stargazers_count":19,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T09:18:04.107Z","etag":null,"topics":["hacktoberfest","hacktoberfest2024","json","json-parse","json-parser","json-parsing","pypi-package","python3"],"latest_commit_sha":null,"homepage":"https://jsonparse.readthedocs.io/en/latest/","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/ctomkow.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":"2018-10-16T22:52:49.000Z","updated_at":"2024-12-30T22:23:51.000Z","dependencies_parsed_at":"2024-06-28T05:21:18.514Z","dependency_job_id":"a6f068be-c48f-4722-9724-5b93e7296cad","html_url":"https://github.com/ctomkow/jsonparse","commit_stats":{"total_commits":110,"total_committers":2,"mean_commits":55.0,"dds":"0.12727272727272732","last_synced_commit":"d2ad2cfa116d6658e414aa2a8d5ab32cd7e4f281"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/ctomkow/jsonparse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctomkow%2Fjsonparse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctomkow%2Fjsonparse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctomkow%2Fjsonparse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctomkow%2Fjsonparse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ctomkow","download_url":"https://codeload.github.com/ctomkow/jsonparse/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctomkow%2Fjsonparse/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28509946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["hacktoberfest","hacktoberfest2024","json","json-parse","json-parser","json-parsing","pypi-package","python3"],"created_at":"2026-01-17T14:24:33.971Z","updated_at":"2026-01-17T14:24:34.083Z","avatar_url":"https://github.com/ctomkow.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsonparse: ctrl-f for json\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/jsonparse)\n![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/ctomkow/jsonparse?label=version\u0026sort=semver)\n[![jsonparse](https://github.com/ctomkow/jsonparse/actions/workflows/jsonparse-buildtest.yml/badge.svg)](https://github.com/ctomkow/jsonparse/actions/workflows/jsonparse-buildtest.yml)\n[![codecov](https://codecov.io/gh/ctomkow/jsonparse/branch/master/graph/badge.svg?token=affX7FZaFk)](https://codecov.io/gh/ctomkow/jsonparse)\n![Static Badge](https://img.shields.io/badge/powered_by-mead-E79A3F?style=flat)\n\n\n\u003c/br\u003e\n\n\u003e **jsonparse** is a simple JSON parsing library. Extract what's needed from key:value pairs.\n\n## What's New\n - Python 2.7 compat. :sweat_smile: :relieved:\n - A new function, [find_value](#find_value), has been added. This function will return all keys of the matched value. :grinning:\n - [CLI tool](#CLI-tool). Parse json text files or stdin via the command line :tada:\n\n# Python Library\n\n## Install\n```bash\npip install jsonparse\n```\n\n## Quickstart\nHere is a quick example of what jsonparse is able to do.\n\n```python\nfrom jsonparse import find_key, find_keys, find_key_chain, find_key_value, find_value\n\ndata = [{\n  \"key0\":\n    {\n      \"key1\": \"result\",\n      \"key2\":\n        {\n          \"key1\": \"result1\",\n          \"key3\": {\"key1\": \"result2\"}\n        }\n    }\n}]\n\nfind_key(data, 'key1')\n['result2', 'result1', 'result']\n\nfind_key_chain(data, ['key0', 'key2', 'key3', 'key1'])\n['result2']\n```\n\n:heavy_plus_sign: See additional documentation in the [API section](#API) below.\n\n\n# CLI tool\n\n## Install\n```bash\npip install jsonparse\n```\n\n## Quickstart\nSummary of cli commands. For complete information, `jp --help`\n\nNote, `jsonparse` and `jp` are equivalent.\n\n`jp key key1 --file text.json`\n\n`jp keys key1 key2 key3 --file text.json`\n\n`jp key-chain my '*' chain --file text.json`\n\n`jp key-value key1 '\"result\"' --file text.json`\n\n`echo '{\"key1\": {\"key2\": 5}}' | jp key key2`\n\n`jp value null --file text.json`\n\n`jp value 42 --file text.json`\n\n`jp value '\"strValue\"' --file text.json`\n\n\n# API\n\n- [jsonparse functions](#Functions)\n    - [find_key](#find_key)\n    - [find_keys](#find_keys)\n    - [find_key_chain](#find_key_chain)\n    - [find_key_value](#find_key_value)\n    - [find_value](#find_value)\n\nThe API examples using the following test data.\n\n```python\ndata = [\n    {\"key\": 1},\n    {\"key\": 2},\n    {\"my\": \n        {\"key\": \n            {\n                \"chain\": \"A\",\n                \"rope\": 5,\n                \"string\": 1.2,\n                \"cable\": False\n            }\n        }\n    },\n    {\"your\":\n    \t{\"key\":\n            {\n                \"chain\": \"B\",\n                \"rope\": 7,\n                \"string\": 0.7,\n                \"cable\": True\n            }\n    \t}\n    }\n]\n```\n\n---\n\n### Functions\n\n```python\nfrom jsonparse import find_key, find_keys, find_key_chain, find_key_value, find_value\n```\n\n---\n\n### find_key\n\u003cpre\u003e\n\u003cb\u003efind_key(\u003c/b\u003e\u003ci\u003edata\u003c/i\u003e: dict | list | OrderedDict, \u003ci\u003ekey\u003c/i\u003e: str\u003cb\u003e)\u003c/b\u003e -\u003e list\n\u003c/pre\u003e\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Will return all values of the matched key.\n\n```python\nfind_key(data, 'chain')\n['A', 'B']\n\nfind_key(data, 'key')\n[1, 2, {'chain': 'A', 'rope': 5, 'string': 1.2, 'cable': False}, {'chain': 'B', 'rope': 7, 'string': 0.7, 'cable': True}]\n```\n\n---\n\n### find_keys\n\u003cpre\u003e\n\u003cb\u003efind_keys(\u003c/b\u003e\u003ci\u003edata\u003c/i\u003e: dict | list | OrderedDict, \u003ci\u003ekeys\u003c/i\u003e: list, \u003ci\u003egroup\u003c/i\u003e: bool = True\u003cb\u003e)\u003c/b\u003e -\u003e list\n\u003c/pre\u003e\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;The default return value is a two dimensional list. `[ [], [], ...]`.\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;To return all values as a one dimensional list, set `group=False`.\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;The ordering of the keys does not matter.\n\n```python\nfind_keys(data, ['rope', 'cable'])\n[[5, False], [7, True]]\n\nfind_keys(data, ['rope', 'cable'], group=False)\n[5, False, 7, True]\n```\n\n---\n\n### find_key_chain\n\u003cpre\u003e\n\u003cb\u003efind_key_chain(\u003c/b\u003e\u003ci\u003edata\u003c/i\u003e: dict | list | OrderedDict, \u003ci\u003ekeys\u003c/i\u003e: list\u003cb\u003e)\u003c/b\u003e -\u003e list\n\u003c/pre\u003e\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;The key chain is an ordered list of keys. The chain needs to start at the root level of the nested data.\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Wildcard `*` can be used as key(s) to match any.\n\n```python\nfind_key_chain(data, ['my', 'key', 'chain'])\n['A']\n\nfind_key_chain(data, ['key'])\n[1, 2]\n\nfind_key_chain(data, ['*', 'key', 'chain'])\n['A', 'B']\n\nfind_key_chain(data, ['*', 'key', '*'])\n['A', 5, 1.2, False, 'B', 7, 0.7, True]\n```\n\n---\n\n### find_key_value\n\u003cpre\u003e\n\u003cb\u003efind_key_value(\u003c/b\u003e\u003ci\u003edata\u003c/i\u003e: dict | list | OrderedDict, \u003ci\u003ekey\u003c/i\u003e: str, \u003ci\u003evalue\u003c/i\u003e: str | int | float | bool | None) -\u003e list\n\u003c/pre\u003e\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;The returned list contains the dictionaries that contain the specified key:value pair.\n\n```python\nfind_key_value(data, 'cable', False)\n[{'chain': 'A', 'rope': 5, 'string': 1.2, 'cable': False}]\n\nfind_key_value(data, 'chain', 'B')\n[{'chain': 'B', 'rope': 7, 'string': 0.7, 'cable': True}]\n```\n\n---\n\n### find_value\n\u003cpre\u003e\n\u003cb\u003efind_value(\u003c/b\u003e\u003ci\u003edata\u003c/i\u003e: dict | list | OrderedDict, \u003ci\u003evalue\u003c/i\u003e: str | int | float | bool | None\u003cb\u003e)\u003c/b\u003e -\u003e list\n\u003c/pre\u003e\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Will return all keys of the matched value.\n\n```python\nfind_value(data, 'A')\n['chain']\n\nfind_value(data, False)\n['cable']\n```\n\n# Python 2.7 Usage\n\n - 2.7 does not guarantee ordering of dictionary's. If ordering matters, use [OrderedDict](https://docs.python.org/2.7/library/collections.html) for all dictionary's in the data.\n\n# Web API\n\n## Documentation\n\nVisit [the swagger API documentation](https://jsonparse.dev/v1/docs)\n\nAll endpoints are HTTP POST requests where you include the searchable JSON data in the request body.\n\n### Brief Endpoint Overiew\n```bash\nPOST /v1/key/{key}\nPOST /v1/keys?key=1\u0026key=2\u0026key=3\u0026key=4...\nPOST /v1/keychain?key=1\u0026key=2\u0026key=3\u0026key=4...\nPOST /v1/keyvalue?key=a\u0026value=1\nPOST /v1/value/{value}\n```\n\n## Quickstart\nLet's practice using the public, free-to-use-no-authentication, web API hosted in GCP Cloud Run.\n\nWe are POST'ing the JSON data with curl, requesting to search for the key, 'key1'. The found key values are returned as JSON.\n\n```bash\ncurl -X POST \"https://jsonparse.dev/v1/key/key1\" \\\n-H 'Content-Type: application/json' \\\n-d '[{\"key0\":{\"key1\":\"result\",\"key2\":{\"key1\":\"result1\",\"key3\":{\"key1\":\"result2\"}}}}]'\n\n[\"result2\",\"result1\",\"result\"]\n```\n\n\u003e OR (using python and requests library)\n\n```python\nimport requests\n\ndata = [{\n    \"key0\":\n    {\n        \"key1\": \"result\",\n        \"key2\":\n        {\n            \"key1\": \"result1\",\n            \"key3\": {\"key1\": \"result2\"}\n        }\n    }\n}]\n\nrequests.post('https://jsonparse.dev/v1/key/key1', json=data).json()\n\n['result2', 'result1', 'result']\n```\n\n## Self-Hosted\n```bash\npip install \"jsonparse[webapi]\"\n\ngunicorn -b 0.0.0.0:8000 jsonparse.webapi:app\n```\n\n\u003e Alternatively, run the docker container\n\n```bash\ndocker run -d ctomkow/jsonparse\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctomkow%2Fjsonparse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fctomkow%2Fjsonparse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctomkow%2Fjsonparse/lists"}