This library provides and abstract base class JSONable which enables easy definition of trivially JSON-able python objects.
Installation: pip install jsonable
- Example:
>>> import jsonable >>> >>> >>> class Fruit(jsonable.Type): ... __slots__ = ('type', 'weight') ... ... def initialize(self, type, weight): ... self.type = str(type) ... self.weight = float(weight) ... >>> class Pie(jsonable.Type): ... __slots__ = ('fruit',) ... ... def initialize(self, fruit): ... self.fruit = [Fruit(f) for f in fruit] ... ... >>> pie = Pie([Fruit('apple', 10.3), Fruit('cherry', 2)]) >>> >>> doc = pie.to_json() >>> doc {'fruit': [{'weight': 10.3, 'type': 'apple'}, {'weight': 2.0, 'type': 'cherry'}]} >>> >>> pie == Pie(doc) True
Metadata
Release files for jsonable 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jsonable-0.3.1.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jsonable-0.3.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 16.6 kB
Release files / jsonable-0.3.1.tar.gz
| Download URL | jsonable-0.3.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
137b676e8e5819fa58518678c3d1f5463cab7e8466f69b3641cbc438042eaee4
|
|
BLAKE2b-256 checksum How to use checksums |
47f1e02151747f823dc9f13900f19d9fd61cc6aa01a5e90b3f8c2b4131bd619c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / jsonable-0.3.1-py2.py3-none-any.whl
| Download URL | jsonable-0.3.1-py2.py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
f7754dd27b4734e42e7f8a61c2336bc98082f715e31e29a061a95843b102dc3a
|
|
BLAKE2b-256 checksum How to use checksums |
0e55c6bcb4ec7f93bf8f98b57d7e185cf5ee02b52473ed84d5611277f710cdcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |