Projects‎ > ‎USDS‎ > ‎

USDS 1.0*

The standard USDS consists of the next parts:
  1. Specification of the Text Dictionary
  2. Specification of USDS Binary

See also:

  1. FAQ
  2. Examples of Using USDS Basic Parser
USDS: Universal serialized data structures (or $S), a binary format which can replace XML and JSON completely. The main differences between XML and JSON are:
  • Integer numbers are used instead of text names for Tags/Keys. The relationship between the numbers and the text names are defined in the "Dictionary". The dictionary can be added to a USDS document (as an option).
  • There are no closing tags.
  • USDS documents can only be formed according to the scheme, which is defined in the dictionary. Polymorphism and optional fields are supported.
  • Numbers are stored in binary form (no text).

An example of the USDS document:

The head includes:

  • The signature '$S';
  • The version of USDS standard (1.0);
  • The dictionary identifier: this field is used for transferring the dictionary and the body separately;
  • The version of the dictionary: you can use these parameters as a version of API in your project;
  • The USDS document size (excluding the Head).

The dictionary starts from the signature 'D'. The dictionary can be absent in the binary document. The sample dictionary shown above can be represented as follows:

USDS DICTIONARY ID=888 v.1.0
{
    1: STRUCT Voucher
    {
        1: VARINT number;
        2: STRING<UTF-8> name;
    } RESTRICT {
notRoot;}

    2: STRUCT Sale
    {
        
1: LONG start;
        2: ARRAY<Voucher> sales;
    }
}

The dictionary contains tags' names and types. Some types require a size specification (for arrays, strings, etc). The strings require specification of a text encode. One or several tags can be defined as "root" tags (e.g. root tag in HTML is <html>).

The body starts from the signature 'B'. The body can be absent in the binary document. The sample body shown above can be represented in XML as the text follows:

<Sale>
    <start>99999999</start>
    <sales>
        <Voucher number="127" name="Hello "/>
        <Voucher number="128" name="world!"/>
    </sales>
</Sale>
The body can contain one or many root tags and they can be different types.
2015.07.31, Andrey Abramov
Last update: 2013.10.03
CC BY 4.0

Comments

The gadget spec URL could not be found