Skip to content

k3utfjson

Action-CI Documentation Status Package

JSON dump and load with enforced UTF-8 encoding.

k3utfjson is a component of pykit3 project: a python3 toolkit set.

Installation

pip install k3utfjson

Quick Start

import k3utfjson

# Load JSON from string (UTF-8)
data = k3utfjson.load('"hello 世界"')
print(data)  # hello 世界

# Dump to JSON string (UTF-8)
json_str = k3utfjson.dump({'msg': '你好'})
print(json_str)  # {"msg": "你好"}

API Reference

k3utfjson

Name

utfjson: force json.dump and json.load in utf-8 encoding.

Status

This library is considered production ready.

License

The MIT License (MIT) - Copyright (c) 2015 Zhang Yanpo (张炎泼)