iidict
English | 中文
处理疑难类型的 JSON 序列化,并能流式读写大文件。
安装
pip install iidict
用法
from datetime import datetime
from decimal import Decimal
from iidict import IIDict
IIDict.dumps({"tags": {"a", "b"}, "at": datetime(2026, 10, 23), "p": Decimal("1.50")})
# '{"tags": ["a", "b"], "at": "2026-10-23 00:00:00", "p": 1.5}'
IIDict.dumps({"a": 1}, n_string=False) # -> bytes
IIDict.loads('{"a": 1}') # {'a': 1}
for key, value in IIDict.iter_loads("huge.json"):
store(key, value)
说明
json.dumps 拒绝 set、datetime、Decimal 和自定义对象,IIDict.dumps 先把它们规范化再序列化。iter_loads 逐个产出顶层对象的键值对,多 GB 文件不必整份进内存;顶层是数组时抛 ValueError,不静默返回空。
许可证
MIT
English
JSON helpers for the messy cases: sets, datetimes, Decimals, streams.
Install
pip install iidict
Usage
from datetime import datetime
from decimal import Decimal
from iidict import IIDict
IIDict.dumps({"tags": {"a", "b"}, "at": datetime(2026, 10, 23), "p": Decimal("1.50")})
# '{"tags": ["a", "b"], "at": "2026-10-23 00:00:00", "p": 1.5}'
IIDict.dumps({"a": 1}, n_string=False) # -> bytes
IIDict.loads('{"a": 1}') # {'a': 1}
for key, value in IIDict.iter_loads("huge.json"):
store(key, value)
Notes
json.dumps refuses sets, datetimes, Decimals and custom objects; IIDict.dumps normalizes them first. iter_loads yields one key/value pair at a time so a multi-gigabyte file never has to fit in memory. A top-level array raises ValueError.
License
MIT
Metadata
Release files for iidict 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iidict-0.0.2.tar.gz | 9.2 kB | Without provenance | Details for iidict-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iidict-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for iidict-0.0.2-py3-none-any.whl |
Total release size: 18.5 kB
Release files / iidict-0.0.2.tar.gz
| Download URL | iidict-0.0.2.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b390cd51a312dd475dafe195171d09c32c43603e70b42a9aebf3b870509fe559
|
|
BLAKE2b-256 checksum How to use checksums |
af366bf88aa6c791bd21fa71de63ac6a033c986131ffdacdd88cdbdcd2157854
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Release files / iidict-0.0.2-py3-none-any.whl
| Download URL | iidict-0.0.2-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72e5a752e3376c3a1dc5232f6d80063600ba4b22ac10e9259146e95cd200a289
|
|
BLAKE2b-256 checksum How to use checksums |
0188f105ddc4a72d98486debaea67a0a391ce79fa2fa97d176546ab4ab0c58ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Security for iidict 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.