Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

customizable_json_encoder-0.0.4.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

customizable_json_encoder-0.0.4-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file customizable_json_encoder-0.0.4.tar.gz.

File metadata

File hashes

Hashes for customizable_json_encoder-0.0.4.tar.gz
Algorithm Hash digest
SHA256 552e25556a2d046b3d9cb48887d99dc037b555dff6dd3a48abc3a73fe9c71b36
MD5 9a9c485fcfaf4e62bf438ab0b41f242b
BLAKE2b-256 b5a1d0d82e56574500fb70e2e323c3d115d8a220e9b618f026e6ea3a0788eb49

See more details on using hashes here.

File details

Details for the file customizable_json_encoder-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for customizable_json_encoder-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 61b476930bdae71faf35019b7713808f830dcf6970fe616d0dd2d535d1effdbb
MD5 3eaea1ba72183664ae13f7af52beb0e6
BLAKE2b-256 6c658809b47dc7d6ab67f03f57ac73676e8a80049c8795e94377e7dcf4054769

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page