JSON
JSON is the lingua franca of data interchange. STYX is designed for human authoring, not machine interchange, which leads to different trade-offs.
Simple object
json
{
"name" : "alice" ,
"age" : 30
}
styx
name alice
age 30
Nested configuration
json
{
"server" : {
"host" : "localhost" ,
"port" : 8080 ,
"tls" : {
"enabled" : true ,
"cert" : "/path/to/cert.pem"
}
}
}
styx
server {
host localhost
port 8080
tls {
enabled true
cert /path/to/cert.pem
}
}
Arrays
json
{
"features" : ["auth" , "logging" , "metrics" ]
}
styx
features (auth logging metrics)
Null values
json
{
"timeout" : null
}
styx
timeout @
Bare keys
json
{ "name" : "alice" }
styx
name alice
Comments
json
{
"port" : 8080
}
styx
port 8080 // default HTTP port
Types are opaque
json
{ "count" : 42 , "label" : "42" }
styx
count 42
label 42
In STYX, both are the scalar 42. The deserializer interprets based on target type.
Attribute syntax
json
{
"server" : {
"host" : "localhost" ,
"port" : 8080
}
}
styx
server host=localhost port=8080