Skip to main content

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)

Metadata

Release files for ebj2 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for ebj2 0.0.1
File Interpreter ABI Platform
ebj2-0.0.1-py3-none-any.whl Python 3 none any Details

Release files / ebj2-0.0.1-py3-none-any.whl

Download URL ebj2-0.0.1-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
baba4809fd80fe2a94e043fced486137216b1160aeeecd8cceb7d9a1c50cce96
BLAKE2b-256 checksum
How to use checksums
866861129a9f6ef1b912c1654a1ed0ac7307c9ba7b1fae0141e1290390f2b15a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page