{"id":22983067,"url":"https://github.com/joeriddles/dictionizr","last_synced_at":"2025-04-02T10:21:21.429Z","repository":{"id":54305893,"uuid":"340982877","full_name":"joeriddles/dictionizr","owner":"joeriddles","description":"A small package to convert custom python objects to dictionaries and back again","archived":false,"fork":false,"pushed_at":"2023-08-10T03:00:54.000Z","size":25,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T02:45:44.700Z","etag":null,"topics":["python"],"latest_commit_sha":null,"homepage":"","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/joeriddles.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":"2021-02-21T19:14:58.000Z","updated_at":"2021-02-25T07:48:28.000Z","dependencies_parsed_at":"2025-02-08T01:27:55.574Z","dependency_job_id":"f9d50709-6ead-4ca3-8aa6-56f01f002e01","html_url":"https://github.com/joeriddles/dictionizr","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeriddles%2Fdictionizr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeriddles%2Fdictionizr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeriddles%2Fdictionizr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeriddles%2Fdictionizr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joeriddles","download_url":"https://codeload.github.com/joeriddles/dictionizr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246794206,"owners_count":20834938,"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":["python"],"created_at":"2024-12-15T02:35:04.680Z","updated_at":"2025-04-02T10:21:21.359Z","avatar_url":"https://github.com/joeriddles.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dictionizr\n\n[![PyPI version](https://badge.fury.io/py/dictionizr.svg)](https://badge.fury.io/py/dictionizr)\n\nThis project was created because I kept creating the methods `to_dict()` and `from_dict()` on many of my python classes and I knew there must be a way to adhere to the DRY principal.\n\n## Installation\n`\u003e pip install dictionizr`\n\n## Usage\n\n### `dictionize` basic object\n```python\nfrom dictionizr import dictionize\n\n\nclass Data():\n    def __init__(self, name: str) -\u003e None:\n        self.name = name\n\n\ndata = Data('Joe')\noutput = dictionize(data)\nprint(output)\n```\n```\n\u003e {'name': 'Joe'}\n```\n\n### `dictionize` complex object\n```python\nfrom __future__ import annotations\nfrom typing import Optional\n\nfrom dictionizr import dictionize\n\n\nclass Data():\n    def __init__(self, name: str, other_data: Optional[Data] = None) -\u003e None:\n        self.name = name\n        self.other_data = other_data\n\n\ndata = Data('Joe')\nnew_data = Data('John', data)\noutput = dictionize(new_data)\nprint(output)\n```\n```\n\u003e {'name': 'Joe', 'other_data': {'name': 'John'}}\n```\n\n### `undictionize` simple object\n```python\nfrom dictionizr import undictionize\n\n\nclass Data():\n    def __init__(self, name: str) -\u003e None:\n        self.name = name\n\n\ndictionary = {'name': 'Joe'}\ndata: Data = undictionize(dictionary)\nprint(data.name)\n```\n```\n\u003e Joe\n```\n\n### `undictionize` complex object\n```python\nfrom dictionizr import undictionize\n\n\nclass Data():\n    def __init__(self, name: str, other_data: Optional[Data] = None) -\u003e None:\n        self.name = name\n        self.other_data = other_data\n\n\ndictionary = {\n    'name': 'Joe',\n    'other_data': {\n        'name': 'John'\n    }\n}\ndata: Data = undictionize(dictionary)\nprint(data.name)\nprint(data.other_data.name)\n```\n```\n\u003e Joe\n\u003e John\n```\n\n## Links\n[PyPi](https://pypi.org/project/dictionizr/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeriddles%2Fdictionizr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoeriddles%2Fdictionizr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeriddles%2Fdictionizr/lists"}