{"id":37791802,"url":"https://github.com/emman27/json_object","last_synced_at":"2026-01-16T15:17:20.601Z","repository":{"id":48400779,"uuid":"108504728","full_name":"emman27/json_object","owner":"emman27","description":"JSON Marshalling for Python","archived":false,"fork":false,"pushed_at":"2025-12-12T09:17:28.000Z","size":42,"stargazers_count":1,"open_issues_count":23,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-13T20:30:55.201Z","etag":null,"topics":["json","marshalling","python","strict-types","unmarshal"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/emman27.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,"governance":null}},"created_at":"2017-10-27T05:50:32.000Z","updated_at":"2017-10-30T08:15:32.000Z","dependencies_parsed_at":"2023-10-04T08:43:44.110Z","dependency_job_id":"bbccf401-0ff8-4675-8359-b2e927fefba3","html_url":"https://github.com/emman27/json_object","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/emman27/json_object","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emman27%2Fjson_object","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emman27%2Fjson_object/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emman27%2Fjson_object/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emman27%2Fjson_object/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emman27","download_url":"https://codeload.github.com/emman27/json_object/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emman27%2Fjson_object/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"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":["json","marshalling","python","strict-types","unmarshal"],"created_at":"2026-01-16T15:17:20.515Z","updated_at":"2026-01-16T15:17:20.577Z","avatar_url":"https://github.com/emman27.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON Object Strict Typing [![CircleCI](https://circleci.com/gh/emman27/json_object.svg?style=svg)](https://circleci.com/gh/emman27/json_object) [![Known Vulnerabilities](https://snyk.io/test/github/emman27/json_object/badge.svg)](https://snyk.io/test/github/emman27/json_object) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/8babe432d6ee4518adc07998a5b67636)](https://www.codacy.com/app/eygohlolz/json_object?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=emman27/json_object\u0026amp;utm_campaign=Badge_Grade)\n\n### Summary\nProvides json unmarshalling to strict types for Python. This ensures you always get safe dictionaries for usage. This allows you to always do the below without worrying about KeyErrors.\n\n```\nschema = JSONObject(...)\njson_parsed = schema.loads(json_unparsed)\njson_parsed['my_key']['my_next_key']\n```\n\nCurrently supports basic Python primitives: `str`, `list`, `dict`, `float`, `int`, `bool`\n\nComing soon: Python DateTime support\n\n### Usage\nFirst, start by declaring your schema of objects you expect to get. For example, if I expect to get a user representation,\n\n```\nuser_schema = JSONObject({\n    username: str,\n    id: int,\n    name: str,\n    active: bool,\n    permissions: [\n        {\n            'resource': 'string',\n            'action': 'string',\n        }\n    ]\n})\n\n# Make the relevant API call...\nreq = requests.get('...')\ndata = user_schema.loads(req.json()) # The loads signature is indifferent between json.loads(s) and s itself.\n\n# You can now do things like\nfor perm in data['permissions']:\n    print(perm['resource'])\n# safely without worrying about KeyErrors\n```\n\n### Example\n```\nfrom json_obj import JSONObject\n\n\u003e\u003e\u003e schema = {\n  'a': str,\n  'b': int,\n  'c': float,\n  'd': boolean,\n}\n\u003e\u003e\u003e loader = JSONObject(schema)\n\u003e\u003e\u003e loader.loads({\n  'a': 34,\n  'b': True,\n})\n\n{\n  'a': '34',\n  'b': 1,\n  'c': 0.0,\n  'd': False,\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femman27%2Fjson_object","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femman27%2Fjson_object","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femman27%2Fjson_object/lists"}