Customizable JSON Encoder for python. module name is cjenc.
Project description
CJEnc; Customizable JSON Encoder
Customizable JSON encoder for json module of python.
Pythonの標準モジュールであるjsonのdump, loadで使えるカスタムJSONエンコーダーです。
cjenc.sample内のクラスや、オリジナルのクラスを追加して、defaultによるカスタマイズだけでは実現できない独自のJSON形式を出力するサポートをします。
How to Use
Shell: $ pip install customizable-json-encoder
Python:
import json
import cjenc import CJEnc
import cjenc.sample import Inline
data = {"status": "OK", "data": [1,2,3,4,5]}
# default json indent
print(json.dumps(data, indent=2))
# {
# "status": "OK",
# "data": [
# 1,
# 2,
# 3,
# 4,
# 5
# ]
# }
# use Inline class
data["data"] = Inline(data["data"], separator=", ")
print(json.dumps(data, indent=2, cls=CJEnc))
# {
# "status": "OK",
# "data": [1, 2, 3, 4, 5]
# }
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
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 customizable_json_encoder-0.0.4.tar.gz.
File metadata
- Download URL: customizable_json_encoder-0.0.4.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
552e25556a2d046b3d9cb48887d99dc037b555dff6dd3a48abc3a73fe9c71b36
|
|
| MD5 |
9a9c485fcfaf4e62bf438ab0b41f242b
|
|
| BLAKE2b-256 |
b5a1d0d82e56574500fb70e2e323c3d115d8a220e9b618f026e6ea3a0788eb49
|
File details
Details for the file customizable_json_encoder-0.0.4-py3-none-any.whl.
File metadata
- Download URL: customizable_json_encoder-0.0.4-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61b476930bdae71faf35019b7713808f830dcf6970fe616d0dd2d535d1effdbb
|
|
| MD5 |
3eaea1ba72183664ae13f7af52beb0e6
|
|
| BLAKE2b-256 |
6c658809b47dc7d6ab67f03f57ac73676e8a80049c8795e94377e7dcf4054769
|