python-objectifier


Namepython-objectifier JSON
Version 1.6 PyPI version JSON
download
home_pagehttps://github.com/xjxckk/python-objectifier/
Summaryobjectifier
upload_time2024-09-02 13:55:07
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ### objectifier

Installation:
`pip install python-objectifier`

```
from objectifier import convert_json_to_object

test_dict = {
        'name': 'Deckow-Crist',
        'catchPhrase': 'Proactive didactic contingency',
        'bs': 'synergize scalable supply-chains'
        }

dict_as_object = convert_json_to_object(test_dict)
dict_as_object.name
> 'Deckow-Crist'

'catchPhrase' in dict_as_object # Retains all original dictionary methods
> True
```

```
test_list = [
    {
        'id': 1,
        'name': 'Leanne Graham',
        'username': 'Bret',
        'email': 'Sincere@april.biz',
        'address': {
            'street': 'Kulas Light',
            'suite': 'Apt. 556',
            'city': 'Gwenborough',
            'zipcode': '92998-3874',
            'geo': {
                'lat': '-37.3159',
                'lng': '81.1496'
            }
        },
        'phone': '1-770-736-8031 x56442',
        'website': 'hildegard.org',
        'company': {
            'name': 'Romaguera-Crona',
            'catchPhrase': 'Multi-layered client-server neural-net',
            'bs': 'harness real-time e-markets'
        }
    },
    {
        'id': 2,
        'name': 'Ervin Howell',
        'username': 'Antonette',
        'email': 'Shanna@melissa.tv',
        'address': {
            'street': 'Victor Plains',
            'suite': 'Suite 879',
            'city': 'Wisokyburgh',
            'zipcode': '90566-7771',
            'geo': {
                'lat': '-43.9509',
                'lng': '-34.4618'
            }
        },
        'phone': '010-692-6593 x09125',
        'website': 'anastasia.net',
        'company': {
            'name': 'Deckow-Crist',
            'catchPhrase': 'Proactive didactic contingency',
            'bs': 'synergize scalable supply-chains'
        }
    }
]

convert_json_to_object(test_list) # Converts list in place
test_list[0].address.suite
> 'Apt. 556'
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/xjxckk/python-objectifier/",
    "name": "python-objectifier",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/b7/53/2f065f18f39591be0183cc4cac70ee19af3b90c44470f0d047aeb3efbb0d/python-objectifier-1.6.tar.gz",
    "platform": null,
    "description": "### objectifier\r\n\r\nInstallation:\r\n`pip install python-objectifier`\r\n\r\n```\r\nfrom objectifier import convert_json_to_object\r\n\r\ntest_dict = {\r\n        'name': 'Deckow-Crist',\r\n        'catchPhrase': 'Proactive didactic contingency',\r\n        'bs': 'synergize scalable supply-chains'\r\n        }\r\n\r\ndict_as_object = convert_json_to_object(test_dict)\r\ndict_as_object.name\r\n> 'Deckow-Crist'\r\n\r\n'catchPhrase' in dict_as_object # Retains all original dictionary methods\r\n> True\r\n```\r\n\r\n```\r\ntest_list = [\r\n    {\r\n        'id': 1,\r\n        'name': 'Leanne Graham',\r\n        'username': 'Bret',\r\n        'email': 'Sincere@april.biz',\r\n        'address': {\r\n            'street': 'Kulas Light',\r\n            'suite': 'Apt. 556',\r\n            'city': 'Gwenborough',\r\n            'zipcode': '92998-3874',\r\n            'geo': {\r\n                'lat': '-37.3159',\r\n                'lng': '81.1496'\r\n            }\r\n        },\r\n        'phone': '1-770-736-8031 x56442',\r\n        'website': 'hildegard.org',\r\n        'company': {\r\n            'name': 'Romaguera-Crona',\r\n            'catchPhrase': 'Multi-layered client-server neural-net',\r\n            'bs': 'harness real-time e-markets'\r\n        }\r\n    },\r\n    {\r\n        'id': 2,\r\n        'name': 'Ervin Howell',\r\n        'username': 'Antonette',\r\n        'email': 'Shanna@melissa.tv',\r\n        'address': {\r\n            'street': 'Victor Plains',\r\n            'suite': 'Suite 879',\r\n            'city': 'Wisokyburgh',\r\n            'zipcode': '90566-7771',\r\n            'geo': {\r\n                'lat': '-43.9509',\r\n                'lng': '-34.4618'\r\n            }\r\n        },\r\n        'phone': '010-692-6593 x09125',\r\n        'website': 'anastasia.net',\r\n        'company': {\r\n            'name': 'Deckow-Crist',\r\n            'catchPhrase': 'Proactive didactic contingency',\r\n            'bs': 'synergize scalable supply-chains'\r\n        }\r\n    }\r\n]\r\n\r\nconvert_json_to_object(test_list) # Converts list in place\r\ntest_list[0].address.suite\r\n> 'Apt. 556'\r\n```\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "objectifier",
    "version": "1.6",
    "project_urls": {
        "Download": "https://github.com/xjxckk/python-objectifier/archive/refs/tags/v0.1.tar.gz",
        "Homepage": "https://github.com/xjxckk/python-objectifier/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b7532f065f18f39591be0183cc4cac70ee19af3b90c44470f0d047aeb3efbb0d",
                "md5": "2d37edc48fccc9ff9482f8fd36ef3854",
                "sha256": "61061c96fc34452abdc9a4f2060b0528d601baef5005e35704ac2e79e9ec5b83"
            },
            "downloads": -1,
            "filename": "python-objectifier-1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "2d37edc48fccc9ff9482f8fd36ef3854",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2443,
            "upload_time": "2024-09-02T13:55:07",
            "upload_time_iso_8601": "2024-09-02T13:55:07.675081Z",
            "url": "https://files.pythonhosted.org/packages/b7/53/2f065f18f39591be0183cc4cac70ee19af3b90c44470f0d047aeb3efbb0d/python-objectifier-1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-02 13:55:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xjxckk",
    "github_project": "python-objectifier",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "python-objectifier"
}
        
Elapsed time: 0.39816s