Automatic json parsing and serialing
Project description
jfjson
Just fucking json!
Converts json to python objects using type annotations.
@dataclass
class Record:
name: str
pos: int
age: float
jfjson.loads('[{"name": "you", "pos": 42, "age": 5.2}]', List[Record])
# [Record(name='you', pos=42, age=5.2)]
It also does data validation and type checking
jfjson.loads('["a", null, 12]', List[Optional[str]])
# jfjson.core.JsonConversionError: Found <class 'int'>, but was expecting typing.Optional[str]: at location .[2]
Also knows how to write any class that has a __dict__ attribute or _asdict() function.
@dataclass
class Record:
name: str
pos: int
age: float
jfjson.dumps([Record(name='you', pos=42, age=5.2)])
# '[{"name": "you", "pos": 42, "age": 5.2}]'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jfjson-0.0.3.tar.gz
(6.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jfjson-0.0.3.tar.gz.
File metadata
- Download URL: jfjson-0.0.3.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
533b688e25678687d4fd7744c711c041cd887b5cc8084866312945dd193fecc5
|
|
| MD5 |
efd79e733ee13acc37129b06b4077a6b
|
|
| BLAKE2b-256 |
97e8bd49761736e0e2fec402b8b224504b9c52ea87db32551f37046cd4c32c3f
|
File details
Details for the file jfjson-0.0.3-py3-none-any.whl.
File metadata
- Download URL: jfjson-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
982b7d84e3b3ee58b6bc279ffdd152f2e1a99e6f729b986cf185c3970c6e849b
|
|
| MD5 |
17e80e9cba4cc28d3885d84f4f26bf4d
|
|
| BLAKE2b-256 |
0f94d926bfdecc4c36f7c4c31aec3723f1db0b44107405ac6da71bf15411465b
|