Fractured Binary JSON
A binary JSON encoding optimized for small storage size.
For more information, see here.
Usage
import frac_json as fj
encoded_object = fj.encode({ "key1": "value" })
decoded_object = fj.decode(encoded_object)
large_object = {
}
encoded_object2 = fj.encode(large_object, compression_level=3)
keys_table = fj.keys_table_from_json(large_object)
encoded_object3 = fj.encode(large_object, global_keys_table_bytes=keys_table)
decoded_object3 = fj.decode(encoded_object3, global_keys_table_bytes=keys_table)
Functions
json_type = Union[dict, list, str, int, float, bool, None]
def encode(
object: json_type,
global_keys_table_bytes: Optional[bytes] = None,
compression_level: Optional[int] = None,
zstd_dict: Optional[bytes] = None,
) -> bytes:
...
def decode(
frac_json_bytes: bytes,
global_keys_table_bytes: Optional[bytes] = None,
zstd_dict: Optional[bytes] = None,
) -> Any:
...
def keys_table_from_keys(keys: List[str]) -> bytes:
...
def keys_table_from_json(
object: Any,
max_count: Optional[int] = None,
occurrence_cutoff: Optional[int] = None,
) -> bytes:
...