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.2.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.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for customizable_json_encoder-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ec8bc0fef2a5391220ed179029198c3695a3bd5d426980e7a4ad235b03e08699
MD5 30f73eebe904a10e8bf624d452761c94
BLAKE2b-256 47dd983dc663c8783aa971ae85d314338952d6ce0bab74bf00acd497f92f5498

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for customizable_json_encoder-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fe85cbbe3219f2f15749442a54643ebf9d85a1864133f6a282224484b22d1271
MD5 52b1bb46f810ed1e50fad55b7580ffe6
BLAKE2b-256 67e47b109ffd48fa810078ccfdd2cb492991a843b0967bf0f094a626dda674d4

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