Embedded Binary JSON
Project description
Embedded Binary JSON
What is EBJ?
EBJ is a format that focuses on storing binary json use RIGHT size.
Byte Order
EBJ always use little-endian. It is more friendly for morden CPU to parse.
Type Codes
0x00 int8
0x01 int16
0x02 int32
0x03 int64
0x04 float32
0x05 float64
0x06 str8 (uint8 length)
0x07 str32 (uint32 length)
0x08 ref8 (str only)
0x09 ref32 (str only)
0x0A true
0x0B false
0x0C null
0x0D array
0x0E end (array, object)
0x0F object
0x10 0
0x11 1
0x12 2
...
0xFF 239
EBJ strXX should be encoded as UTF-8 bytes.
How to use EBJ?
This repo contains a base Python version EBJ implementation called ebj2
. The
following lines show how to use ebj2
to dump and load EBJ bytes.
Install:
pip install ebj2
Usage:
# Load module
import ebj2
# Dump EBJ
byts = ebj2.dumps(['ebj2 is awesome!'])
# Load EBJ
msgs = ebj2.loads(byts)
# Dump to fp
ebj2.dump([], fp)
# Load from fp
ebj2.load(fp)
Why should i use EBJ?
At least EBJ will save your 33% disk space to store json. Also it is very fast.
(ebj2
maybe very slow, because it use pure-python, but still usable)
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
ebj2-0.0.1-py3-none-any.whl
(3.3 kB
view details)
File details
Details for the file ebj2-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: ebj2-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | baba4809fd80fe2a94e043fced486137216b1160aeeecd8cceb7d9a1c50cce96 |
|
MD5 | 01382e2e1c3306ef75515015deeda240 |
|
BLAKE2b-256 | 866861129a9f6ef1b912c1654a1ed0ac7307c9ba7b1fae0141e1290390f2b15a |