Json library which enable user to parse and dump data with hex escape
Project description
Hexson
Json library designed for binary data processing.
Different from built-in json library, Hexson can encode invisible characters with hex escape instead of unicode escape.
Install
pip3 install hexson
Usage
loader & dumpper
Serialize from / Deserialize to file:
json_dict = hexson.load(fd)
hexson.dump(json_dict, fd)
Serialize from / Deserialize to string:
json_dict = hexson.loads(json_string)
json_string = hexson.dumps(json_dict)
Function load
and loads
will parse string in Json to bytes in Python by default.
And you can convert it into string in Python by set parameter utf_8_string
to True
, just like:
json_dict = hexson.load(fd, utf_8_string=True)
json_dict = hexson.loads(json_string, utf_8_string=True)
Elasticsearch serializer
Hexson can work along with official elasticsearch
Python client library.
import elasticsearch
hexson_serializer = hexson.JSONSerializer()
es_conn = elasticsearch.Elasticsearch(serializer=hexson_serializer)
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
hexson-0.0.5.tar.gz
(5.1 kB
view hashes)