fbpx
Wikipedia

UBJSON

Universal Binary JSON (UBJSON) is a computer data interchange format. It is a binary form directly imitating JSON, but requiring fewer bytes of data. It aims to achieve the generality of JSON, combined with being much easier to process than JSON.

UBJSON
Original author(s)Riyad Kalla
Stable release
Draft 12
Written inVarious languages
Operating systemAny
PlatformCross-platform
TypeData interchange
LicenseApache 2.0
Websiteubjson.org

Rationale and Objectives edit

UBJSON is a proposed successor to BSON, BJSON and others. UBJSON has the following goals:

  • Complete compatibility with the JSON specification – there is a 1:1 mapping between standard JSON and UBJSON.
  • Ease of implementation – only including data types that are widely supported in popular programming languages so that there are no problems with certain languages not being supported well.
  • Ease of use – it can be quickly understood and adopted.
  • Speed and efficiency – UBJSON uses data representations that are (roughly) 30% smaller than their compacted JSON counterparts and are optimized for fast parsing. Streamed serialisation is supported, meaning that the transfer of UBJSON over a network connection can start sending data before the final size of the data is known.

Data types and syntax edit

UBJSON data can be either a value or a container.

Value types edit

UBJSON uses a single binary tuple to represent all JSON value types:[1]

 type [length] [data] 

Each element in the tuple is defined as:

type edit

The type is a 1-byte ASCII character used to indicate the type of the data following it. The ASCII characters were chosen to make manually walking and debugging data stored in the UBJSON format as easy as possible (e.g. making the data relatively readable in a hex editor). Types are available for the five JSON value types. There is also a no-op type used for stream keep-alive.

High-precision numbers are represented as an arbitrarily long, UTF-8 string-encoded numeric value.

length (optional) edit

The length is an integer number (e.g. uint8, or int64) encoding the size of the data payload in bytes. It is used for strings, high-precision numbers and optionally containers. They are omitted for other types.

Length is encoded following the same convention as integers, thus including its own type. For example, the string hello is encoded as S,U,0x05,h,e,l,l,o.

data (optional) edit

A sequence of bytes representing the actual binary data for this type of value. All numbers are in big-endian order.

Container types edit

Similarly to JSON, UBJSON defines two container types: array and object.[2]

Arrays are ordered sequences of elements, represented as a [ followed by zero or more elements of value and container type and a trailing ].

Objects are labeled sets of elements, represented as a { followed by zero or more key-value pairs and a trailing }. Each key is a string with the S character omitted, and each "value" can be any element of value or container type.

Alternatively, arrays and objects may indicate the number of elements they contain as # followed by an integer number before their first element, in which case the trailing ] or } is omitted. Additionally, if all elements have the same type, the types can be omitted and replaced by a single $ followed by the type, in which case the element count must follow immediately. For example, the array ["a","b","c"] may be represented as [,$,C,#,U,0x03,a,b,c.

Binary data edit

While there is no explicit binary type, binary data is stored in a strongly typed array of uint8 values. This ensures binary efficiency while maintaining compatibility with JSON, even though JSON has no direct support for binary data.[3][4]

Representation edit

The MIME type 'application/ubjson' is recommended, as is the file extension '.ubj' when stored in a file-system.[4]

Software support edit

See also edit

References edit

  1. ^ "Value Types | Universal Binary JSON Specification". Retrieved 20 July 2019.
  2. ^ "Container Types | Universal Binary JSON Specification". Retrieved 20 July 2019.
  3. ^ "Binary Data | Universal Binary JSON Specification". Retrieved 20 July 2019.
  4. ^ a b c "UBJSON (.ubj)—Wolfram Language Documentation". Retrieved 20 July 2019.
  5. ^ "UBJSON Storage Format". Retrieved 20 July 2019.

External links edit

  • Official website  

ubjson, this, article, needs, additional, citations, verification, please, help, improve, this, article, adding, citations, reliable, sources, unsourced, material, challenged, removed, find, sources, news, newspapers, books, scholar, jstor, october, 2019, lear. This article needs additional citations for verification Please help improve this article by adding citations to reliable sources Unsourced material may be challenged and removed Find sources UBJSON news newspapers books scholar JSTOR October 2019 Learn how and when to remove this template message Universal Binary JSON UBJSON is a computer data interchange format It is a binary form directly imitating JSON but requiring fewer bytes of data It aims to achieve the generality of JSON combined with being much easier to process than JSON UBJSONOriginal author s Riyad KallaStable releaseDraft 12Written inVarious languagesOperating systemAnyPlatformCross platformTypeData interchangeLicenseApache 2 0Websiteubjson wbr org Contents 1 Rationale and Objectives 2 Data types and syntax 2 1 Value types 2 1 1 type 2 1 2 length optional 2 1 3 data optional 2 2 Container types 2 3 Binary data 3 Representation 4 Software support 5 See also 6 References 7 External linksRationale and Objectives editUBJSON is a proposed successor to BSON BJSON and others UBJSON has the following goals Complete compatibility with the JSON specification there is a 1 1 mapping between standard JSON and UBJSON Ease of implementation only including data types that are widely supported in popular programming languages so that there are no problems with certain languages not being supported well Ease of use it can be quickly understood and adopted Speed and efficiency UBJSON uses data representations that are roughly 30 smaller than their compacted JSON counterparts and are optimized for fast parsing Streamed serialisation is supported meaning that the transfer of UBJSON over a network connection can start sending data before the final size of the data is known Data types and syntax editUBJSON data can be either a value or a container Value types edit UBJSON uses a single binary tuple to represent all JSON value types 1 type length data Each element in the tuple is defined as type edit The type is a 1 byte ASCII character used to indicate the type of the data following it The ASCII characters were chosen to make manually walking and debugging data stored in the UBJSON format as easy as possible e g making the data relatively readable in a hex editor Types are available for the five JSON value types There is also a no op type used for stream keep alive Null Z No op N no operation to be ignored by the receiving end Boolean types true T and false F Numeric types int8 i uint8 U int16 I int32 l int64 L float32 d float64 D and high precision H ASCII character C UTF 8 string SHigh precision numbers are represented as an arbitrarily long UTF 8 string encoded numeric value length optional edit The length is an integer number e g uint8 or int64 encoding the size of the data payload in bytes It is used for strings high precision numbers and optionally containers They are omitted for other types Length is encoded following the same convention as integers thus including its own type For example the string hello is encoded as S U 0x05 h e l l o data optional edit A sequence of bytes representing the actual binary data for this type of value All numbers are in big endian order Container types edit Similarly to JSON UBJSON defines two container types array and object 2 Arrays are ordered sequences of elements represented as a followed by zero or more elements of value and container type and a trailing Objects are labeled sets of elements represented as a followed by zero or more key value pairs and a trailing Each key is a string with the S character omitted and each value can be any element of value or container type Alternatively arrays and objects may indicate the number of elements they contain as followed by an integer number before their first element in which case the trailing or is omitted Additionally if all elements have the same type the types can be omitted and replaced by a single followed by the type in which case the element count must follow immediately For example the array a b c may be represented as C U 0x03 a b c Binary data edit While there is no explicit binary type binary data is stored in a strongly typed array of uint8 values This ensures binary efficiency while maintaining compatibility with JSON even though JSON has no direct support for binary data 3 4 Representation editThe MIME type application ubjson is recommended as is the file extension ubj when stored in a file system 4 Software support editTeradata Database 5 The Wolfram Language introduced support for UBJSON in 2017 with version 11 1 of the language 4 See also editComparison of data serialization formats JSON CBOR Smile binary JSON Protocol Buffers Action Message Format Apache Thrift MessagePack Document oriented database e g MongoDB Abstract Syntax Notation One ASN 1 Wireless Binary XML WBXML Efficient XML InterchangeReferences edit Value Types Universal Binary JSON Specification Retrieved 20 July 2019 Container Types Universal Binary JSON Specification Retrieved 20 July 2019 Binary Data Universal Binary JSON Specification Retrieved 20 July 2019 a b c UBJSON ubj Wolfram Language Documentation Retrieved 20 July 2019 UBJSON Storage Format Retrieved 20 July 2019 External links editOfficial website nbsp Retrieved from https en wikipedia org w index php title UBJSON amp oldid 1117185828, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.