Skip to main content

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)

Source distribution for jsonable 0.3.1
File Size Uploaded
jsonable-0.3.1.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jsonable 0.3.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

1 release file

0.0.4

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page