Skip to content

Instantly share code, notes, and snippets.

@BonsaiDen
Created January 13, 2012 16:21
Show Gist options
  • Save BonsaiDen/1607302 to your computer and use it in GitHub Desktop.
Save BonsaiDen/1607302 to your computer and use it in GitHub Desktop.
BiSON doc

The Format

BiSON uses a bit stream in order to achieve maximum possible compression of the different data types, the format is described below.

Each token is prepended by a 3 bit field that determines its type, there are 7 different types:

  • 0: Either a Boolean or null, a 2 bit field with the following values follows:

    • 0 = false
    • 1 = true
    • 2 = null
    • 3 is currently unused
  • 1: A Integer in the range of - to +

  • 2: A integer.

  • 3: A String

  • 4: Start of an Array, all values until the next type = 7 are to be appended to this array.

  • 5: Start of an Object. Pairs of String and a value follow, the string is to be used as the key in the object to which the value will be associated with.

  • 6: End of the last opened Array or Object.

  • 7: End of stream. TODO switch with b03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment