Project

asciipack

0.0
No commit activity in last 3 years
No release in over 3 years
AsciiPack is an object serialization inspired by MessagePack.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
~> 2.11
 Project Readme

AsciiPack

AsciiPack is an object serialization inspired by MessagePack.

AsciiPack is use easy by Web. because all serialize object is only writed by ascii strings.

JSON is 27 chars:
{"compact":true,"binary":0}

AsciiPack is 19 chars:
r2NcompactYMbinary0
    r2 => map of length 2.
    Ncompact => string of length 7 and value is "compact".
    Y => true.
    Mbinary => string of length 6 abd value is "binary".
    0 => fixint value is 0.

Formats

Overview

format name first char
int 4 a
int 8 b
int 16 c
int 32 d
int 64 e
(blank) f
uint 8 g
uint 16 h
uint 32 i
uint 64 j
float 32 k
float 64 l
(blank) m
str 8 n
str 16 o
str 32 p
(blank) q
map 4 r
map 8 s
map 16 t
map 32 u
array 4 v
array 8 w
array 16 x
array 32 y
(blank) z
positive fixint 0-9A-F
fixstr G-V
nil W
false X
true Y
(blank) Z

Notation in diagrams

All object serialize format.
key | [length] | [variable]

`F` is Hexadecimal number by one char.
`D` is Decimal number.

int

int 4:
a | F

int 8:
b | FF

int 16:
c | FFFF

int 32:
d | FFFFFFFF

int 64:
e | FFFFFFFFFFFFFFFF

positive fixint:
0-9A-F

uint 8:
g | FF

uint 16:
h | FFFF

uint 32:
i | FFFFFFFF

uint 64:
j | FFFFFFFFFFFFFFFF

float

Value abide IEEE 754 format.

float 32:
k | FFFFFFFF

float 64:
l | FFFFFFFFFFFFFFFF

str

fixstr:
G-V | data

str 8:
n | FF | data

str 16:
o | FFFF | data

str 32:
p | FFFFFFFF | data

map

map 4:
r | F | N * (key + value)

map 8:
s | FF | N * (key + value)

map 16:
t | FFFF | N * (key + value)

map 32:
u | FFFFFFFF | N * (key + value)

* N is the size of map

array

array 4:
v | F | N * value

array 8:
w | FF | N * value

array 16:
x | FFFF | N * value

array 32:
y | FFFFFFFF | N * value

* N is the size of array

nil

nil:
W

boolean

false:
X

true:
Y

Comparison

Serializer Length Speed Readability Writability
JSON ×
MessagePack × ×
AsciiPack

Demo

Interactive demo site http://ksss.github.io/AsciiPack/ (using /js/asciipack.js)