Skip to main content

Wrapper module to provide a simple property accessor for JSON objects.

Project description

JSONobj

JSONobj is a Python module for providing attribute-like access to the properties of JSON objects.

Requirement

  • Python 2.7 or above

Installation

pip install jsonobj

Basic Usage

>>> import jsonobj
>>> obj = jsonobj.loads('{"prop1": "value"}')
>>> obj.prop1
'value'
>>> obj.prop1 = 'changed'
>>> obj.prop2 = ['foo', 'bar', {'fiz': 'buz'}]
>>> 'prop2' in obj
True
>>> obj.dict
{'prop1': 'changed', 'prop2': ['foo', 'bar', {'fiz': 'buz'}]}
>>> obj.prop2[2].fiz
'buz'
>>> del obj.prop1
>>> jsonobj.dumps(obj)
'{"prop2": ["foo", "bar", {"fiz": "buz"}]}'

Documentation

Documentation is available online.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonobj-0.1.0.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

jsonobj-0.1.0-py2.py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page