{"id":15477041,"url":"https://github.com/srittau/python-json-get","last_synced_at":"2025-04-05T02:14:00.028Z","repository":{"id":18888926,"uuid":"85509872","full_name":"srittau/python-json-get","owner":"srittau","description":"Get values from JSON objects using a path expression","archived":false,"fork":false,"pushed_at":"2023-06-26T12:12:33.000Z","size":155,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-10T10:21:27.916Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/srittau.png","metadata":{"files":{"readme":"README.rst","changelog":"NEWS.rst","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":"2017-03-19T21:26:09.000Z","updated_at":"2022-07-26T14:42:26.000Z","dependencies_parsed_at":"2025-02-11T00:01:57.190Z","dependency_job_id":null,"html_url":"https://github.com/srittau/python-json-get","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srittau%2Fpython-json-get","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srittau%2Fpython-json-get/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srittau%2Fpython-json-get/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srittau%2Fpython-json-get/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srittau","download_url":"https://codeload.github.com/srittau/python-json-get/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276188,"owners_count":20912288,"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":[],"created_at":"2024-10-02T03:42:31.678Z","updated_at":"2025-04-05T02:14:00.008Z","avatar_url":"https://github.com/srittau.png","language":"Python","readme":"Python JSON Get\n===============\n\n.. image:: https://img.shields.io/pypi/l/json-get.svg\n   :target: https://pypi.python.org/pypi/json-get/\n.. image:: https://img.shields.io/github/release/srittau/python-json-get/all.svg\n   :target: https://github.com/srittau/python-json-get/releases/\n.. image:: https://img.shields.io/pypi/v/json-get.svg\n   :target: https://pypi.python.org/pypi/json-get/\n.. image:: https://img.shields.io/github/workflow/status/srittau/python-json-get/Test%20and%20lint\n   :target: https://github.com/srittau/python-json-get/actions\n\nGet values from JSON objects usings a path expression. Optional type\nchecking is possible:\n\n\u003e\u003e\u003e from jsonget import json_get, json_get_default, JList\n\u003e\u003e\u003e j = {\n...     \"foo\": {\"num\": 3.4, \"s\": \"Text\"},\n...     \"arr\": [10, 20, 30],\n... }\n\u003e\u003e\u003e json_get(j, \"/foo/num\")\n3.4\n\u003e\u003e\u003e json_get(j, \"/arr[1]\")\n20\n\u003e\u003e\u003e json_get(j, \"/foo/unknown\")\nTraceback (most recent call last):\n    ...\nValueError: JSON path '/foo/unknown' not found\n\nValues are optionally checked against one of the following types:\n``str``, ``int``, ``float``, ``bool``, ``list``, and ``dict``.\nChecking for null values is not supported:\n\n\u003e\u003e\u003e json_get(j, \"/foo/num\", str)\nTraceback (most recent call last):\n    ...\nTypeError: wrong JSON type str != float\n\n``float`` will match any number, ``int`` will only match numbers without\na fractional part:\n\n\u003e\u003e\u003e json_get(j, \"/foo/num\", float)\n3.4\n\u003e\u003e\u003e json_get(j, \"/foo/num\", int)\nTraceback (most recent call last):\n    ...\nTypeError: wrong JSON type int != float\n\nAdditionally, the type of list values can be checked:\n\n\u003e\u003e\u003e json_get(j, \"/arr\", JList(int))\n[10, 20, 30]\n\n``json_get_default()`` can be used to return a default value if a given\npath does not exist:\n\n\u003e\u003e\u003e json_get_default(j, \"/bar\", \"default value\")\n'default value'\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrittau%2Fpython-json-get","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrittau%2Fpython-json-get","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrittau%2Fpython-json-get/lists"}