{"id":13936907,"url":"https://github.com/gazpachoking/jsonref","last_synced_at":"2025-05-15T03:06:19.778Z","repository":{"id":7907389,"uuid":"9289732","full_name":"gazpachoking/jsonref","owner":"gazpachoking","description":"Automatically dereferences JSON references within a JSON document.","archived":false,"fork":false,"pushed_at":"2025-04-21T23:45:40.000Z","size":186,"stargazers_count":136,"open_issues_count":12,"forks_count":29,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-05T16:47:32.366Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"http://jsonref.readthedocs.org","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/gazpachoking.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"gazpachoking","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2013-04-08T06:12:12.000Z","updated_at":"2025-04-25T09:58:17.000Z","dependencies_parsed_at":"2024-01-17T22:37:19.131Z","dependency_job_id":"8416d8c5-b1cb-444e-872f-25293129cfcc","html_url":"https://github.com/gazpachoking/jsonref","commit_stats":{"total_commits":183,"total_committers":10,"mean_commits":18.3,"dds":"0.10382513661202186","last_synced_commit":"82c038b56d2c7cd3cff7a054ff165fd7c1922343"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gazpachoking%2Fjsonref","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gazpachoking%2Fjsonref/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gazpachoking%2Fjsonref/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gazpachoking%2Fjsonref/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gazpachoking","download_url":"https://codeload.github.com/gazpachoking/jsonref/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253584492,"owners_count":21931547,"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":["hacktoberfest"],"created_at":"2024-08-07T23:03:06.546Z","updated_at":"2025-05-15T03:06:19.761Z","avatar_url":"https://github.com/gazpachoking.png","language":"Python","funding_links":["https://github.com/sponsors/gazpachoking"],"categories":["Python"],"sub_categories":[],"readme":"# jsonref\n\n[![image](https://github.com/gazpachoking/jsonref/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/gazpachoking/jsonref/actions/workflows/test.yml?query=branch%3Amaster)\n[![image](https://readthedocs.org/projects/jsonref/badge/?version=latest)](https://jsonref.readthedocs.io/en/latest/)\n[![image](https://coveralls.io/repos/gazpachoking/jsonref/badge.png?branch=master)](https://coveralls.io/r/gazpachoking/jsonref)\n[![image](https://img.shields.io/pypi/v/jsonref?color=%2334D058\u0026label=pypi%20package)](https://pypi.org/project/jsonref)\n\n`jsonref` is a library for automatic dereferencing of [JSON\nReference](https://datatracker.ietf.org/doc/html/draft-pbryan-zyp-json-ref-03)\nobjects for Python (supporting Python 3.7+).\n\nThis library lets you use a data structure with JSON reference objects,\nas if the references had been replaced with the referent data.\n\n```python console\n\u003e\u003e\u003e from pprint import pprint\n\u003e\u003e\u003e import jsonref\n\n\u003e\u003e\u003e # An example json document\n\u003e\u003e\u003e json_str = \"\"\"{\"real\": [1, 2, 3, 4], \"ref\": {\"$ref\": \"#/real\"}}\"\"\"\n\u003e\u003e\u003e data = jsonref.loads(json_str)\n\u003e\u003e\u003e pprint(data)  # Reference is not evaluated until here\n{'real': [1, 2, 3, 4], 'ref': [1, 2, 3, 4]}\n```\n\n# Features\n\n-   References are (optionally) evaluated lazily. Nothing is dereferenced until it is\n    used.\n-   Recursive references are supported, and create recursive python data\n    structures.\n\nReferences objects are replaced by lazy lookup proxy objects to support lazy \ndereferencing. They are almost completely transparent.\n\n```python console\n\u003e\u003e\u003e data = jsonref.loads('{\"real\": [1, 2, 3, 4], \"ref\": {\"$ref\": \"#/real\"}}')\n\u003e\u003e\u003e # You can tell it is a proxy by using the type function\n\u003e\u003e\u003e type(data[\"real\"]), type(data[\"ref\"])\n(\u003cclass 'list'\u003e, \u003cclass 'jsonref.JsonRef'\u003e)\n\u003e\u003e\u003e # You have direct access to the referent data with the __subject__\n\u003e\u003e\u003e # attribute\n\u003e\u003e\u003e type(data[\"ref\"].__subject__)\n\u003cclass 'list'\u003e\n\u003e\u003e\u003e # If you need to get at the reference object\n\u003e\u003e\u003e data[\"ref\"].__reference__\n{'$ref': '#/real'}\n\u003e\u003e\u003e # Other than that you can use the proxy just like the underlying object\n\u003e\u003e\u003e ref = data[\"ref\"]\n\u003e\u003e\u003e isinstance(ref, list)\nTrue\n\u003e\u003e\u003e data[\"real\"] == ref\nTrue\n\u003e\u003e\u003e ref.append(5)\n\u003e\u003e\u003e del ref[0]\n\u003e\u003e\u003e # Actions on the reference affect the real data (if it is mutable)\n\u003e\u003e\u003e pprint(data)\n{'real': [2, 3, 4, 5], 'ref': [2, 3, 4, 5]}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgazpachoking%2Fjsonref","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgazpachoking%2Fjsonref","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgazpachoking%2Fjsonref/lists"}