The friendly data format for human & machine

Release Status Prerelease (Please help by reviewing the specs and submitting issues!)

Another Encoding Format?

Today's data formats present us with a dilemma: Use text based formats that are bloated and slow, or use binary formats that humans can't read. Wouldn't it be nice to have the benefits of both, and none of the drawbacks?

Twin Formats

Edit Text, Transmit Binary

Encoded data should be easy to read, easy to edit, as well as low-cost to process and transmit.

Concise Encoding accomplishes this using 1:1 compatible twin formats: one in text, and one in binary.

Keep everything in binary while transmitting and storing on machines, then seamlessly convert to/from text only where a human needs to be involved.

Rich Type Support

All the types you need

Tired of coercing your data into strings? Concise Encoding supports these types natively:

Examples

All examples are valid Concise Text Encoding documents that can be transparently 1:1 converted to/from Concise Binary Encoding.

Numeric Types

                
c1
{
    boolean       = @true
    binary-int    = -0b10001011
    octal-int     = 0o644
    decimal-int   = -10000000
    hex-int       = 0xfffe0001
    decimal-float = -14.125
    hex-float     = 0x5.1ec4p20
    not-a-number  = @nan
    infinity      = @inf
    n-infinity    = -@inf
}
                
            

Strings & String-Like

                
c1
{
    unquoted-string = no-quotes-needed
    quoted-string   = "A string delimited by quotes"
    url             = |u https://example.com/|
    email           = |u mailto:me@somewhere.com|
}
                
            

Other Basic Types

                
c1
{
    uuid            = @f1ce4567-e89b-12d3-a456-426655440000
    date            = 2019-7-1
    time            = 18:04:00.940231541/E/Prague
    timestamp       = 2010-7-15/13:28:15.415942344/Z
    null            = @null
}
                
            

Containers & Arrays

                
c1
{
    list             = [1 2.5 "a string"]
    map              = {one=1 2=two today=2020-09-10}
    bytes            = |u8x 01 ff de ad be ef|
    uint16-hex-array = |u16x 91fe 443a 9c15|
    int16-array      = |i16 7374 17466 -9957|
    float32-array    = |f32 1.5e10 -8.31e-12|
}
                
            

Markup

                
c1
{
    main-view = <View,
        <Image src=|u images/avatar-image.jpg|>
        <Text id=HelloText,
            Hello! Please choose a name!
        >
        <TextInput id=NameInput style={height=40 borderColor=gray} OnChange="\.@@
            HelloText.SetText("Hello, " + NameInput.Text + "!")
        @@",
            Name me!
        >
    >
}
                
            

References

                
c1
{
    marked_object    = &id1:{
        description = "This map will be referenced later as $id1"
        value = -@inf
        child_elements = @null
        recursive = $id1
    }
    ref1             = $id1
    ref2             = $id1
    outside_ref      = $|u https://xyz.com/document.cte#some_id|
}
                
            

Metadata & Comments

                
c1
// Metadata about the entire documents
(
    // _ct is the creation time, _d is description, _v is version.
    // See common generic metadata spec.
    _ct = 2019-9-1/22:14:01
    _d = "Some description"
    _v = "1.1.0"
    whatever = "some arbitrary data"
)
{
    /* Comments look very C-like, except:
       /* Nested comments are allowed! */
    */

    // Double-slash comments are also possible.

    (info = "something interesting about a_list")
    a_list           = [1 2 3]
}
                
            

Custom Types

                
c1
{
    // Custom types are user-defined, with user-supplied codecs.
    custom-text     = |ct cplx(2.94+3i)|
    custom-binary   = |cb 04 f6 28 3c 40 00 00 40 40|
}
                
            

See the Resources page or Github page for more information.