ubjson / universal-binary-json

Community workspace for the Universal Binary JSON Specification.
115 stars 12 forks source link

Change ARRAY and OBJECT markers #7

Closed kxepal closed 11 years ago

kxepal commented 12 years ago

Short story:

Riyad Kalla had proposed to change ARRAY and OBJECT markers pairs A...E and O...E to [...] and {...} respectively.

This looks like a good idea for the next reasons:

  1. UBJSON becomes closer to his father, JSON.
  2. Since UBJSON is binary format, this change makes easy to read data in hex format:

    Draft 8 (v0.8) style:

    0000   4F 53 69 03 66 6F 6F 41    OSi.fooA
    0008   53 69 03 62 61 72 4F 53    Si.barOS
    0010   69 03 62 61 7A 69 2A 45    i.bazi*E
    0018   45 45                      EE

    new style:

    0000   7B 53 69 03 66 6F 6F 5B    {Si.foo[
    0008   53 69 03 62 61 72 7B 53    Si.bar{S
    0010   69 03 62 61 7A 69 2A 7D    i.bazi*}
    0018   5D 7D                      ]}

    Note, how easy to visual guess where end array or object.

  3. This change completely breaks backward compatibility that is already broken by other improvements(;
  4. Now we've got new type of errors as ending marker mismatch.

The main flaw of this change that it breaks pretty [ ] notation. However, as for me, if I'd like to work with binary data, I'll choose hex dump format. If I need to read the data, I prefer YAML one.

AnyCPU commented 12 years ago

Ref #6.

ghost commented 11 years ago

ACCEPTED

Merged into Draft 9 spec: http://ubjson.org/type-reference/