What is AXON¶
AXON is eXtended Object Notation (AXON). It’s a simple text based format
for interchanging of objects, documents and data.
It tries to combine the best of JSON, XML and YAML.
AXON is designed as text based language for data exchange in first place.
AXONis easy to understand, read and write.AXONis easy to parse and generate.- Syntax of
AXONis independent of programming languages. AXONcan be used as simple text based language for serialization of objects, documents and variety of data.
Creation of AXON had following objectives:
- Overcoming lack of support of date/time, decimal and binary data in
JSON. - Overcoming inability to represent in
JSONcomplex data with cross-references natively. - Extension of
JSONfor native support of named/taged data structures (typed complex data, elements of documents etc.) in order to act in cases whereXMLis more suitable thanJSON. - Removing
','as mandatory character-separator for items in containers. - Saving relative simplicity of the language compared to
JSON.
AXON is designed as text based format that has compact form and
formatted form in both C and Python style for ease of developers.
AXON is an object notation for data, which are composed from atomic values
by several rules of composition:
| Name | Rule | Example |
|---|---|---|
| list | [ V … V ] | [1 3.14 3.25$ -∞ ?] |
| tuple | ( V … V ) | (true 12:00 2001-12-31 2001-12-31T12:00) |
| dictionary | { K:V … K:V } |
{alpha:1 beta:2 gamma:3 "other chars":4}
|
| mapping | N { N:V … N:V } |
greek {alpha:123 beta:212 gamma:322}
|
| sequence | N { V … V } |
primes {2 3 5 7 11 13 17 19 23}
|
| element | N { N:V … N:V V … V } |
node {id:1 node{id:2 "AAA"} node{id:3 "BBB"}}
|
| instance | N { V … V N:V … N:V } |
datarow { 1 2003-12-01T12:30 T:12.5 R:0.95 W:11 D:"NW"}
|
| empty | N { } |
empty { }
|
where N denotes a name, K denotes a key, V denotes a value.
Here is an example of AXON message:
| statement form | formatted expression form |
|---|---|
axon:
name: "AXON is eXtended Object Notation"
short_name: "AXON"
python_library: "pyaxon"
atomic_values:
int: [0 -1 17]
float: [3.1428 1.5e-17]
decimal: [10d 1000.35D -1.25e6d]
bool: [true false]
string: "abc абв 中文本"
multiline_string: "one
two
three"
date: 2012-12-31
time: [12:30:34 12:35:12.000120 12:35+03]
datetime: [2012-12-31T12:30 2012-12-31T12:35+03]
binary: |UTcJFhV3cl97ZEk+BA0hWggDUj8lbE0bQH5r
Uy0nNjwmZDpANClsAj4WeDsfCWkcW2Bdc0VNQ
CQVZCBhXxFGJBpSLGs3HGlcbSdgdH4ab34UBT
wndTs2MXdSOxIGBgdYclFQYnlDH3NfUSI1LEc
HDARDeFcDCBwiPTAZODU=
complex_values:
anonymous:
list: ["one" "two" "three"]
dict: {"one":1 "two":2 "three":3}
tuple: ("nodes" "edges")
named:
mapping: rgb:
red:16 green:32 blue:64
element: node:
id: 1
node:
id: 2
class: "A"
node:
id: 3
class: "B"
sequence: primes:
2 3 5 7 11 13 17 19 23 29 31
instance: row:
12 2003-12-01 12:00
T: 12.1 R:0.5 W:5 D:"W"
|
axon {
name: "AXON is eXtended Object Notation"
short_name: "AXON"
python_library: "pyaxon"
atomic_values {
int: [0 -1 17]
float: [3.1428 1.5e-17]
decimal: [10d 1000.35D -1.25e6d]
bool: [true false]
string: "abc абв 中文本"
multiline_string: "one
two
three"
date: 2012-12-31
time: [12:30:34 12:35:12.000120 12:35+03]
datetime: [2012-12-31T12:30 2012-12-31T12:35+03]
binary: |UTcJFhV3cl97ZEk+BA0hWggDUj8lbE0bQH5r
Uy0nNjwmZDpANClsAj4WeDsfCWkcW2Bdc0VNQ
CQVZCBhXxFGJBpSLGs3HGlcbSdgdH4ab34UBT
wndTs2MXdSOxIGBgdYclFQYnlDH3NfUSI1LEc
HDARDeFcDCBwiPTAZODU=
}
complex_values {
anonymous {
list: ["one" "two" "three"]
dict: {"one":1 "two":2 "three":3}
tuple: ("nodes" "edges")
}
named {
mapping: rgb {
red:16 green:32 blue:64}
element: node {
id: 1
node {
id: 2
class: "A"}
node {
id: 3
class: "B"}
}
sequence: primes {
2 3 5 7 11 13 17 19 23 29 31}
instance: row {
12 2003-12-01 12:00
T: 12.1 R:0.5 W:5 D:"W"}
}
}
}
|
| compact expression form | |
axon{name:"AXON is eXtended Object Notation" python_library:"pyaxon" short_name:"AXON"
atomic_values{binary:|UTcJFhV3cl97ZEk+BA0hWggDUj8lbE0bQH5rUy0nNjwmZDpANClsAj4We
DsfCWkcW2Bdc0VNQCQVZCBhXxFGJBpSLGs3HGlcbSdgdH4ab34UBTwndTs2MXdSOxIGBgdYclFQYnlDH
3NfUSI1LEcHDARDeFcDCBwiPTAZODU=
bool:[true false] date:2012-12-31 datetime:[2012-12-31T12:30 2012-12-31T12:35+03]
decimal:[10d 1000.35D -1.25E+6d] float:[3.1428 1.5e-17] int:[0 -1 17] multiline_string:"one
two
three" string:"abc абв 中文本" time:[12:30:34 12:35:12.000120 12:35+03]}
complex_values{anonymous{dict:{one:1 three:3 two:2} list:["one" "two" "three"]
tuple:("nodes" "edges")} named{element:node{id:1 node{class:"A" id:2} node{class:"B" id:3}}
instance:row{12 2003-12-01 12:00 D:"W" R:0.5 T:12.1 W:5} mapping:rgb{blue:64 green:32 red:16}
sequence:primes{2 3 5 7 11 13 17 19 23 29 31}}}}
| |
Python pyaxon library¶
pyaxon is an MIT Licensed
python library for AXON.
There are introductory IPython notebooks:
Repository for AXON and pyaxon.
Mirror on github.
Blog about AXON.
History of changes.