Comparison of data-serialization formats: Difference between revisions

Content deleted Content added
Comparison table: change to notes
m resize table font
 
(687 intermediate revisions by more than 100 users not shown)
Line 1:
{{Short description|None}}
{{cleanup|date=August 2009}}
This is a '''comparison of [[data serialization]] formats''', various ways to convert complex [[object (computer science)|object]]s to sequences of [[bit]]s. It does not include [[markup language]]s used exclusively as [[document file format]]s.
{{unreferenced|date=August 2009}}
{{Prose|date=August 2009}}
 
==Overview==
This article is a '''comparison of [[data serialization]] [[file format|format]]s''', different ways to convert complex [[object (computer science)|object]]s to sequences of [[bit]]s. It does not include [[markup language]]s used as [[document file format]]s.
 
{{sort-under}}
==Comparison table==
{{sticky table start}}
{| class="wikitable"
{| class="wikitable sortable sort-under sticky-table-head" style="font-size:75%"
|-
! Name
! Creator/Maintainer-maintainer
! Based on
! Standard
! Standardized?{{definition needed|date=January 2021}}<!-- A spec is a form of standardization. So what is this column representing? ISO-like standards? Then why are BEPs and PEPs valid? -->
! [[Specification]]
! [[Binary format|Binary]]?
! [[Human-readable]]?
! Supports [[reference (computer science)|reference]]s?{{ref|stdrefs|e}}
! Can store [[relational database|relational]] data?
! Schema-[[interface description language|IDL]]?
! Validation
! Standard [[API|Access]]s
! Supports [[zero-copy]] operations
|-
| [[Apache Arrow]]
| [[Apache Software Foundation]]
| {{n/a}}
| {{partial|''De facto''}}
| [https://arrow.apache.org/docs/format/Columnar.html Arrow Columnar Format]
| {{yes}}
| {{no}}
| {{yes}}
| {{yes|Built-in}}
| C, C++, C#, Go, Java, JavaScript, Julia, Matlab, Python, R, Ruby, Rust, Swift
| {{yes}}
|-
| [[Apache Avro]]
| [[Apache Software Foundation]]
| {{n/a}}
| {{no}}
| [https://avro.apache.org/docs/current/spec.html Apache Avro™ Specification]
| {{yes}}
| {{partial}}{{ref|avrojson|g}}
| {{n/a}}
| {{yes|Built-in}}
| C, C#, C++, Java, PHP, Python, Ruby
| {{n/a}}
|-
| [[Apache Parquet]]
| [[Apache Software Foundation]]
| {{n/a}}
| {{no}}
| [https://parquet.apache.org Apache&nbsp;Parquet]
| {{yes}}
| {{no}}
| {{no}}
| {{n/a}}
| Java, Python, C++
| {{no}}
|-
| [[Apache Thrift]]
| [[Facebook]] (creator)<br>[[Apache Software Foundation|Apache]] (maintainer)
| {{n/a}}
| {{no}}
| [http://thrift.apache.org/static/files/thrift-20070401.pdf Original whitepaper]
| {{yes}}
| {{partial}}{{ref|thrifttxt|c}}
| {{no}}
| {{yes|Built-in}}
| C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml, Delphi and other languages<ref>[https://thrift.apache.org/ Apache Thrift]</ref>
| {{n/a}}
|-
| [[ASN.1]]
| [[International Organization for Standardization|ISO]], [[International Electrotechnical Commission|IEC]], [[ITU-T]]
| {{n/a}}
| {{yes}}
| ISO/IEC 8824 / ITU-T X.680 (syntax) and ISO/IEC 8825 / ITU-T X.690 (encoding rules) series. X.680, X.681, and X.683 define syntax and semantics.
| {{yes|[[Basic Encoding Rules|BER]], [[Distinguished Encoding Rules|DER]], [[Packed Encoding Rules|PER]], [[Octet encoding rules|OER]], or custom via [[Encoding Control Notation|ECN]]}}
| {{yes|[[XML Encoding Rules|XER]], [[JSON encoding rules|JER]], [[Generic String Encoding Rules|GSER]], or custom via [[Encoding Control Notation|ECN]]}}
| {{yes}}{{ref|asn1refs|f}}
| {{yes|Built-in}}
| {{n/a}}
| {{yes|[[Octet encoding rules|OER]]}}
|-
| [[Bencode]]
| [[Bram Cohen]] (creator)<br>[[BitTorrent, Inc.]] (maintainer)
| {{n/a}}
| {{yes| ''De facto'' as {{abbr|BEP|BitTorrent Enhancement Proposal}}}}
| Part of [http://bittorrent.org/beps/bep_0003.html BitTorrent protocol specification]
| {{partial|Except numbers and delimiters, being ASCII}}
| {{no}}
| {{no}}
| {{no}}
| {{no}}
| {{no}}
|-
| [[BSON]]
| [[MongoDB]]
| [[JSON]]
| {{no}}
| [http://bsonspec.org BSON Specification]
| {{yes}}
| {{no}}
| {{no}}
| {{no}}
| {{no}}
| {{no}}
|-
| [[Cap%27n Proto]]
| Kenton Varda
| {{n/a}}
| {{no}}
| [https://capnproto.org/encoding.html Cap'n Proto Encoding Spec]
| {{yes}}
| {{partial}}{{ref|capnptextformat|h}}
| {{no}}
| {{yes}}
| {{no}}
| {{yes}}
|-
| [[CBOR]]
| Carsten Bormann, [[Paul Hoffman (engineer)|P. Hoffman]]
| [[MessagePack]]<ref>{{cite web|url=https://github.com/msgpack/msgpack/issues/258#issuecomment-449978394|title=CBOR relationship with msgpack|first1=Carsten|last1=Bormann|website=[[GitHub]] |date=2018-12-26|access-date=2023-08-14}}</ref>
| {{yes}}
| RFC 8949
| {{yes}}
| {{no}}
| {{yes}}, <br/>through tagging
| {{yes|[https://tools.ietf.org/html/rfc8610 CDDL]}}
| {{yes|[[FIDO_Alliance|FIDO2]]}}
| {{no}}
|-
| [[Comma-separated values]] (CSV)
| RFC author:<br>Yakov Shafranovich
| {{n/a}}
| {{partial|Myriad informal variants}}
| RFC 4180<br>(among others)
| {{no}}
| {{yes}}
| {{no}}
| {{no}}
| {{no}}
| {{no}}
|-
| [[Common Data Representation]] (CDR)
| [[Object Management Group]]
| {{n/a}}
| {{yes}}
| [[General Inter-ORB Protocol]]
| {{yes}}
| {{no}}
| {{yes}}
| {{yes}}
| Ada, C, C++, Java, Cobol, Lisp, Python, Ruby, Smalltalk
| {{n/a}}
|-
| [[D-Bus]] Message Protocol
| [[freedesktop.org]]
| {{n/a}}
| {{yes}}
| [https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol D-Bus Specification]
| {{yes}}
| {{no}}
| {{no}}
| {{partial}}<br>(Signature strings)
| {{yes|[[D-Bus|Yes]]}}
| {{n/a}}
|-
| [[Efficient XML Interchange]] (EXI)
| [[World Wide Web Consortium|W3C]]
| [[XML]], Efficient XML
| {{Yes}}
| [https://www.w3.org/TR/exi/ Efficient XML Interchange (EXI) Format 1.0]
| {{Yes}}
| {{yes|[[XML]]}}
| {{Yes|[[XPointer]], [[XPath]]}}
| {{Yes|[[XML Schema (W3C)|XML Schema]]}}
| {{Yes|[[Document Object Model|DOM]], [[Simple API for XML|SAX]], [[StAX]], [[XQuery]], [[XPath]]}}
| {{n/a}}
|-
| [[Extensible Data Notation]] (edn)
| [[Rich Hickey]] / Clojure community
| [[Clojure]]
| {{yes}}
| [https://github.com/edn-format/edn Official edn spec]
| {{no}}
| {{yes}}
| {{no}}
| {{no}}
| Clojure, Ruby, Go, C++, Javascript, Java, CLR, ObjC, Python<ref>{{cite web|url=https://github.com/edn-format/edn/wiki/Implementations|title=Implementations|website=[[GitHub]] }}</ref>
| {{no}}
|-
| [[FlatBuffers]]
| Google
| {{n/a}}
| {{no}}
| [https://google.github.io/flatbuffers/ Flatbuffers GitHub]
| {{yes}}
| {{yes|[[Apache Arrow]]}}
| {{partial}}<br>(internal to the buffer)
| {{yes|[https://google.github.io/flatbuffers/flatbuffers_guide_writing_schema.html Yes]}}
| C++, Java, C#, Go, Python, Rust, JavaScript, PHP, C, Dart, Lua, TypeScript
| {{yes}}
|-
| [[Fast Infoset]]
| [[International Organization for Standardization|ISO]], [[International Electrotechnical Commission|IEC]], [[ITU-T]]
| [[XML]]
| {{yes}}
| ITU-T X.891 and ISO/IEC 24824-1:2007
| {{yes}}
| {{no}}
| {{yes|[[XPointer]], [[XPath]]}}
| {{yes|[[XML schema]]}}
| {{yes|[[Document Object Model|DOM]], [[Simple API for XML|SAX]], [[XQuery]], [[XPath]]}}
| {{n/a}}
|-
| [[FHIR]]
| [[Health Level 7]]
| [[REST]] basics
| {{Yes}}
| [[Fast Healthcare Interoperability Resources]]
| {{Yes}}
| {{Yes}}
| {{Yes}}
| {{Yes}}
| Hapi for FHIR<ref>{{cite web|url=http://hapifhir.io/|title=HAPI FHIR - The Open Source FHIR API for Java|website=hapifhir.io}}</ref> [[JSON]], [[XML]], [[Turtle (syntax)|Turtle]]
| {{no}}
|-
| [[Ion (serialization format)|Ion]]
| [[Amazon.com|Amazon]]
| [[JSON]]
| {{no}}
| [https://amzn.github.io/ion-docs/spec.html The Amazon Ion Specification]
| {{yes}}
| {{yes}}
| {{no}}
| {{Yes|[https://amzn.github.io/ion-schema/ Ion schema]}}
| C, C#, Go, Java, JavaScript, Python, Rust
| {{n/a}}
|-
| [[Java (programming language)|Java]] serialization
| [[Oracle Corporation]]
| {{n/a}}
| {{yes}}
| [https://docs.oracle.com/javase/8/docs/technotes/guides/serialization/index.html Java Object Serialization]
| {{yes}}
| {{no}}
| {{yes}}
| {{no}}
| {{yes}}
| {{n/a}}
|-
| [[JSON]]
| [[Douglas Crockford]]
| [[JavaScript syntax]]
| [http://tools.ietf.org/html/rfc4627 RFC 4627]
| {{yes}}
| [https://tools.ietf.org/html/std90 STD 90]/RFC 8259<br>(ancillary:<br>RFC 6901,<br>RFC 6902), [http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf ECMA-404], [https://www.iso.org/standard/71616.html ISO/IEC 21778:2017]
| {{no}}, but see [[BSON]], [[Smile (data interchange format)|Smile]], [[UBJSON]]
| {{yes}}
| {{yes|[https://tools.ietf.org/html/rfc6901 JSON Pointer (RFC{{nbsp}}6901)], or alternately, [http://goessner.net/articles/JsonPath/ JSONPath], [https://web.archive.org/web/20120922110739/http://bluelinecity.com/software/jpath/ JPath], [https://web.archive.org/web/20121203081945/http://www.jspon.org/ JSPON], [https://github.com/lloyd/JSONSelect json:select()]; and [[JSON-LD]]}}
| {{partial}}<br>([http://json-schema.org/ JSON Schema Proposal], [[ASN.1]] with [[JSON encoding rules|JER]], [http://www.kuwata-lab.com/kwalify/ Kwalify] {{Webarchive|url=https://web.archive.org/web/20210812231831/http://www.kuwata-lab.com/kwalify/ |date=2021-08-12 }}, [http://rjbs.manxome.org/rx/ Rx], [[JSON-LD]]
| {{partial}}<br>([https://github.com/dscape/clarinet Clarinet], [https://www.sitepen.com/blog/jsonquery-data-querying-beyond-jsonpath JSONQuery] / [https://www.sitepen.com/blog/resource-query-language-a-query-language-for-the-web-nosql RQL], [http://goessner.net/articles/JsonPath/ JSONPath]), [[JSON-LD]]
| {{no}}
|-
| [[MessagePack]]
| Sadayuki Furuhashi
| [[JSON]] (loosely)
| {{no}}
| [https://github.com/msgpack/msgpack/blob/master/spec.md MessagePack format specification]
| {{yes}}
| {{no}}
| {{no}}
| {{partial}} ([http://www.kuwata-lab.com/kwalify/ Kwalify], [http://rjbs.manxome.org/rx/ Rx], [http://www.json.com/json-schema-proposal/ JSON Schema Proposal])
| {{no}}
| {{no}}
| {{yes}}
|-
| [[Netstring]]s
| [[Dan Bernstein]]
| {{n/a}}
| {{no}}
| [http://cr.yp.to/proto/netstrings.txt netstrings.txt]
| {{partial|Except ASCII delimiters}}
| {{yes}}
| {{no}}
| {{no}}
| {{no}}
| {{yes}}
|-
| [[OGDL]]
| Rolf Veen
| {{dunno}}
| [http://ogdl.sourceforge.net/spec/ 1.0 Working draft]
| {{yes}}{{ref|binogdl|ono}}
| [http://ogdl.org/spec/ Specification]
| {{yes|[http://ogdl.org/spec/binary.html Binary specification]}}
| {{yes}}
| {{yes|[http://ogdl.org/spec/path.html Path specification]}}
|
| {{yes|[http://ogdl.org/spec/schema.html Schema WD]}}
|
|
| {{n/a}}
|-
| [[OPC Unified Architecture|OPC-UA Binary]]
| [[OPC Foundation]]
| {{n/a}}
| {{no}}
| [https://opcfoundation.org opcfoundation.org]
| {{yes}}
| {{no}}
| {{yes}}
| {{no}}
| {{no}}
| {{n/a}}
|-
| [[OpenDDL]]
| [[Eric Lengyel]]
| [[C (programming language)|C]], [[PHP]]
| {{no}}
| [http://openddl.org/ OpenDDL.org]
| {{no}}
| {{yes}}
| {{yes}}
| {{no}}
| {{yes|[http://openddl.org/ OpenDDL library]}}
| {{n/a}}
|-
| [[PHP serialization format]]
| PHP Group
| {{n/a}}
| {{yes}}
| {{no}}
| {{yes}}
| {{yes}}
| {{yes}}
| {{no}}
| {{yes}}
| {{n/a}}
|-
| [[Pickle (Python)]]
| [[Guido van Rossum]]
| [[Python (programming language)|Python]]
| {{yes|''De facto'' as [[Python Enhancement Proposal|PEP]]s}}
| [https://www.python.org/dev/peps/pep-3154/ PEP 3154 – Pickle protocol version 4]
| {{yes}}
| {{no}}
| {{yes}}<ref>[https://github.com/python/cpython/blob/v3.9.0/Lib/pickle.py#L137-L144 cpython/Lib/pickle.py]</ref>
| {{no}}
| {{yes}}
| {{no}}
|-
| [[Property list]]
| [[NeXT]] (creator)<br/>[[Apple Inc.|Apple]] (maintainer)
| {{dunno}}
| ''de facto''{{ref|plist DTD|p}}
| {{yes}}{{ref|plistbin|bpartial}}
| [https://www.apple.com/DTDs/PropertyList-1.0.dtd Public DTD for XML format]
| {{yes}}{{ref|plisttext|t}}
| {{yes}}{{ref|plbin|a}}
|
| {{yes}}{{ref|pltxt|b}}
|
| {{no}}
| {{dunno}}
| [https://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html Cocoa], [https://developer.apple.com/mac/library/documentation/CoreFoundation/Conceptual/CFPropertyLists/CFPropertyLists.html CoreFoundation], [https://web.archive.org/web/20081210064322/http://docs.sun.com/app/docs/doc/802-2112/6i63mn65o?a=view OpenStep], [https://web.archive.org/web/20110519164921/http://gnustep.org/resources/documentation/Developer/Base/Reference/NSPropertyList.html GnuStep]
| {{no}}
|-
| [[Protocol Buffers]] (protobuf)
| [[Google]]
| {{n/a}}
| {{no}}
| [https://developers.google.com/protocol-buffers/docs/encoding Developer Guide: Encoding], [https://developers.google.com/protocol-buffers/docs/reference/proto2-spec proto2 specification], and [https://developers.google.com/protocol-buffers/docs/reference/proto3-spec proto3 specification]
| {{yes}}
| {{yes}}{{ref|pbtextformat|d}}
| {{no}}
| {{yes|Built-in}}
| C++, Java, C#, Python, Go, Ruby, Objective-C, C, Dart, Perl, PHP, R, Rust, Scala, Swift, Julia, Erlang, D, Haskell, ActionScript, Delphi, Elixir, Elm, Erlang, GopherJS, Haskell, Haxe, JavaScript, Kotlin, Lua, Matlab, Mercurt, OCaml, Prolog, Solidity, Typescript, Vala, Visual Basic
| {{no}}
|
|
|
|-
| {{nobr|[[S-expression]]s}}
| based on [[LispJohn McCarthy (programmingcomputer languagescientist)|LispJohn McCarthy]]; (original)<br />[[Ron Rivest]] (proposed standardinternet authordraft)
| [[Lisp (programming language)|Lisp]], [[Netstring]]s
| ''de facto'';<br />but [http://theory.lcs.mit.edu/~rivest/sexp.txt an Internet-Draft] exists
| {{partial|Largely ''de facto''}}
| [http://people.csail.mit.edu/rivest/Sexp.txt "S-Expressions"] {{Webarchive|url=https://web.archive.org/web/20131007024815/http://people.csail.mit.edu/rivest/Sexp.txt |date=2013-10-07 }} [[Internet Draft]]
| {{yes}}, ''canonical representation''
| {{yes}}, ''advanced transport representation''
| {{no}}
| {{no}}
| {{yes}}
|
|
|
| {{n/a}}
|-
| [[ThriftSmile (protocoldata interchange format)|ThriftSmile]]
| Tatu Saloranta
| [[Facebook]] (creator)<br/>[[Apache Software Foundation|Apache]] (maintainer)
| [[JSON]]
|
| {{no}}
|
| [https://github.com/FasterXML/smile-format-specification Smile Format Specification]
|
| {{yes}}
|
| {{no}}
| {{yes}}
| {{partial}}<br>([http://json-schema.org/ JSON Schema Proposal], other JSON schemas/IDLs)
| {{partial}}<br>(via JSON APIs implemented with Smile backend, on Jackson, Python)
| {{n/a}}
|-
| [[SOAP]]
| [[W3C]]
| [[XML]]
| {{yes}}
| {{nobr|[[W3C Recommendation]]s:}}<br>[https://www.w3.org/TR/2000/NOTE-SOAP-20000508/ SOAP/1.1]<br>[https://www.w3.org/TR/soap12/ SOAP/1.2]
| {{partial}}<br>({{nobr|[[Efficient XML Interchange]]}}, {{nobr|[[Binary XML]]}}, {{nobr|[[Fast Infoset]]}}, [[Message Transmission Optimization Mechanism|MTOM]], {{nobr|[[XSD]] base64 data}})
| {{yes}}
| {{yes|Built-in id/ref, [[XPointer]], [[XPath]]}}
| {{yes|[[WSDL]], [[XML schema]]}}
| {{yes|[[Document Object Model|DOM]], [[Simple API for XML|SAX]], [[XQuery]], [[XPath]]}}
| {{n/a}}
|-
| {{nobr|[[SDXF|Structured Data eXchange Format]]s}}
| [[Max Wildgrube]]
| {{n/a}}
| {{yes}}
| RFC 3072
| {{yes}}
| {{no}}
| {{no}}
| {{no}}
|
| {{n/a}}
|-
| [[UBJSON]]
| The Buzz Media, LLC
| [[JSON]], [[BSON]]
| {{no}}
| [http://ubjson.org/ ubjson.org]
| {{yes}}
| {{no}}
| {{no}}
| {{no}}
| {{no}}
| {{n/a}}
|-
| [[External Data Representation|eXternal Data Representation]] (XDR)
| [[Sun Microsystems]] (creator)<br>[[IETF]] (maintainer)
| {{n/a}}
| {{yes}}
| [https://tools.ietf.org/html/std67 STD 67]/RFC 4506
| {{yes}}
| {{no}}
| {{yes}}
| {{yes}}
| {{yes}}
| {{n/a}}
|-
| [[XML]]
| [[W3C]]
| [[SGML]]
| [[W3C Recommendation]]s:<br/>[http://www.w3.org/TR/2008/REC-xml-20081126/ 1.0 (Fifth Edition)]<br/>[http://www.w3.org/TR/2006/REC-xml11-20060816/ 1.1 (Second Edition)]
| {{partial}} ([[Binary XML]])
| {{yes}}
| {{nobr|[[W3C Recommendation]]s:}}<br>[http://www.w3.org/TR/2008/REC-xml-20081126/ 1.0 (Fifth Edition)]<br>[http://www.w3.org/TR/2006/REC-xml11-20060816/ 1.1 (Second Edition)]
|
| {{partial}}<br>({{nobr|[[Efficient XML Interchange]]}}, {{nobr|[[Binary XML]]}}, {{nobr|[[Fast Infoset]]}}, {{nobr|[[XSD]] base64 data}})
| {{yes}} (several [[XML schema]] languages)
| {{yes}}
| [[DOM]], [[SAX]], [[XQuery]], [[XPath]]
| {{yes|[[XPointer]], [[XPath]]}}
| {{yes|[[XML schema]], [[RELAX NG]]}}
| {{yes|[[Document Object Model|DOM]], [[Simple API for XML|SAX]], [[XQuery]], [[XPath]]}}
| {{n/a}}
|-
| [[XML-RPC]]
| [[Dave Winer]]<ref name="xmlrpc-hist">{{cite web|url=https://www.xml.com/pub/a/ws/2001/04/04/soap.html|title=A Brief History of SOAP|website=www.xml.com}}</ref>
| [[XML]]
| {{no}}
| [http://xmlrpc.com/spec.md XML-RPC Specification]
| {{no}}
| {{yes}}
| {{no}}
| {{no}}
| {{no}}
| {{no}}
|-
| [[YAML]]
| Clark Evans,<br>Ingy döt Net,<br>and Oren Ben-Kiki
|
| [[C (programming language)|C]], [[Java (programming language)|Java]], [[Perl]], [[Python (programming language)|Python]], [[Ruby (programming language)|Ruby]], [[Email]], [[HTML]], [[MIME]], [[URI]], [[XML]], [[Simple API for XML|SAX]], [[SOAP]], [[JSON]]<ref>{{cite web|url=http://yaml.org/spec/1.2/spec.html#id2708710|title=YAML Ain't Markup Language (YAML) Version 1.2|first1=Oren |last1=Ben-Kiki |first2=Clark |last2=Evans |first3=Ingy döt |last3=Net|date=2009-10-01|work=The Official YAML Web Site|access-date=2012-02-10}}</ref>
| [http://www.yaml.org/spec/1.2/spec.html YAML.org]
| {{no}}
| [http://www.yaml.org/spec/1.2/spec.html Version 1.2]
| {{no}}
| {{yes}}
| {{yes}}
| {{partial}} <br>([http://www.kuwata-lab.com/kwalify/ Kwalify] {{Webarchive|url=https://web.archive.org/web/20210812231831/http://www.kuwata-lab.com/kwalify/ |date=2021-08-12 }}, [http://rjbs.manxome.org/rx/ Rx], built-in language type-defs)
| {{no}}
| {{no}}
|-
! Name
! Creator-maintainer
! Based on
! Standardized?
! [[Specification]]
! [[Binary format|Binary]]?
! [[Human-readable]]?
! Supports [[reference (computer science)|reference]]s?{{ref|stdrefs|e}}
! Schema-[[interface description language|IDL]]?
! Standard [[API]]s
! Supports [[zero-copy]] operations
|}
{{sticky table end}}
 
{{ordered list
| list-style-type=lower-alpha
| {{note|plbin}}The current default format is binary.
| {{note|pltxt}}The "classic" format is plain text, and an XML format is also supported.
| {{note|thrifttxt}}Theoretically possible due to abstraction, but no implementation is included.
| {{note|pbtextformat}}The primary format is binary, but text and JSON formats are available.<ref>{{cite web|url=https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.text_format|title=text_format.h - Protocol Buffers|website=Google Developers}}</ref><ref>{{cite web|url=https://developers.google.com/protocol-buffers/docs/proto3#json|title=JSON Mapping - Protocol Buffers|website=Google Developers}}</ref>
| {{note|stdrefs}}Means that generic tools/libraries know how to encode, decode, and dereference a reference to another piece of data in the same document. A tool may require the [[Interface description language|IDL]] file, but no more. Excludes custom, non-standardized referencing techniques.
| {{note|asn1refs}}ASN.1 has X.681 (Information Object System), X.682 (Constraints), and X.683 (Parameterization) that allow for the precise specification of open types where the types of values can be identified by integers, by [[Object identifier|OIDs]], etc. OIDs are a standard format for globally unique identifiers, as well as a standard notation ("absolute reference") for referencing a component of a value. For example, PKIX uses such notation in RFC 5912. With such notation (constraints on parameterized types using information object sets), generic ASN.1 tools/libraries can automatically encode/decode/resolve references within a document.
| {{note|avrojson}}The primary format is binary, a json encoder is available.<ref>{{cite web|url=https://avro.apache.org/docs/1.9.2/spec.html#json_encoding|title=Avro Json Format}}</ref>
| {{note|capnptextformat}}The primary format is binary, but a text format is available.
}}
 
==Syntax comparison of human-readable formats==
 
{{sticky table start}}
{| class="wikitable sortable sort-under sticky-table-head" style="font-size:75%"
|-
! Format
! [[Nullable type|Null]]
! [[Boolean data type|Boolean]] true
! [[Boolean data type|Boolean]] false
! [[Integer (computer science)|Integer]]
! [[Floating-point]]
! [[String (computer science)|String]]
! [[Array data type|Array]]
! [[Associative array]]/[[Object (computer science)|Object]]
|-
| [[XML Encoding Rules|ASN.1]]<br>(XML Encoding Rules)
| {{nobr|<code><foo /></code>}}
| <code><foo>true</foo></code>
| <code><foo>false</foo></code>
| <code><foo>685230</foo></code>
| <code><foo>6.8523015e+5</foo></code>
| {{nobr|<code><foo>A to Z</foo></code>}}
| <syntaxhighlight lang="xml"><SeqOfUnrelatedDatatypes>
<isMarried>true</isMarried>
<hobby />
<velocity>-42.1e7</velocity>
<bookname>A to Z</bookname>
<bookname>We said, "no".</bookname>
</SeqOfUnrelatedDatatypes></syntaxhighlight>
| An object (the key is a field name):
<syntaxhighlight lang="xml"><person>
<isMarried>true</isMarried>
<hobby />
<height>1.85</height>
<name>Bob Peterson</name>
</person></syntaxhighlight>
 
A data mapping (the key is a data value):
<syntaxhighlight lang="xml"><competition>
<measurement>
<name>John</name>
<height>3.14</height>
</measurement>
<measurement>
<name>Jane</name>
<height>2.718</height>
</measurement>
</competition></syntaxhighlight>
{{ref|guess|a}}
|-
| [[Comma-separated values|CSV]]{{ref|csvguess|b}}
| <code>null</code>{{ref|guess|a}}<br>(or an empty element in the row){{ref|guess|a}}
| <code>1</code>{{ref|guess|a}}<br><code>true</code>{{ref|guess|a}}
| <code>0</code>{{ref|guess|a}}<br><code>false</code>{{ref|guess|a}}
| <code>685230</code><br><code>-685230</code>{{ref|guess|a}}
| <code>6.8523015e+5</code>{{ref|guess|a}}
| {{nobr|<code>A to Z</code>}}<br><code>{{nobr|"We said, ""no""."}}</code>
| <code>true,,-42.1e7,"A to Z"</code>
| <pre>42,1
A to Z,1,2,3</pre>
|-
| [[Extensible Data Notation|edn]]
| <code>nil</code>
| <code>true</code>
| <code>false</code>
| <code>685230</code><br><code>-685230</code>
| <code>6.8523015e+5</code>
| <code>"A to Z"</code>, <code>"A \"up to\" Z"</code>
| <code>[true nil -42.1e7 "A to Z"]</code>
| <code>{:kw 1, "42" true, "A to Z" [1 2 3]}</code>
|-
| [[Ion (Serialization format)|Ion]]
|
<code>null</code><br />
<code>null.null</code><br />
<code>null.bool</code><br />
<code>null.int</code><br />
<code>null.float</code><br />
<code>null.decimal</code><br />
<code>null.timestamp</code><br />
<code>null.string</code><br />
<code>null.symbol</code><br />
<code>null.blob</code><br />
<code>null.clob</code><br />
<code>null.struct</code><br />
<code>null.list</code><br />
<code>null.sexp</code>
| <code>true</code>
| <code>false</code>
| <code>685230</code><br><code>-685230</code><br /><code>0xA74AE</code><br /><code>0b111010010101110</code>
| <code>6.8523015e5</code>
| <code>"A to Z"</code><br><br><code><nowiki>'''</nowiki><br>A <br>to <br>Z<br><nowiki>'''</nowiki></code>
|<syntaxhighlight lang="json">
[true, null, -42.1e7, "A to Z"]
</syntaxhighlight>
|<syntaxhighlight lang="javascript">
{'42': true, 'A to Z': [1, 2, 3]}
</syntaxhighlight>
|-
| [[Netstring]]s{{ref|netguess|c}}
| <code>0:,</code>{{ref|guess|a}}<br><code>4:null,</code>{{ref|guess|a}}
| <code>1:1,</code>{{ref|guess|a}}<br><code>4:true,</code>{{ref|guess|a}}
| <code>1:0,</code>{{ref|guess|a}}<br><code>5:false,</code>{{ref|guess|a}}
| <code>6:685230,</code>{{ref|guess|a}}
| <code>9:6.8523e+5,</code>{{ref|guess|a}}
| {{nobr|<code>6:A to Z,</code>}}
| <code>29:4:true,0:,7:-42.1e7,6:A to Z,,</code>
| {{nobr|<code>41:9:2:42,1:1,,25:6:A to Z,12:1:1,1:2,1:3,,,,</code>}}{{ref|guess|a}}
|-
| [[JSON]]
| <code>null</code>
| <code>true</code>
| <code>false</code>
| <code>685230</code><br><code>-685230</code>
| <code>6.8523015e+5</code>
| {{nobr|<code>"A to Z"</code>}}
|<syntaxhighlight lang="json">
[true, null, -42.1e7, "A to Z"]
</syntaxhighlight>
|<syntaxhighlight lang="json">
{"42": true, "A to Z": [1, 2, 3]}
</syntaxhighlight>
|-
| [[OGDL]]{{Verify source|date=September 2009}}
| <code>null</code>{{ref|guess|a}}
| <code>true</code>{{ref|guess|a}}
| <code>false</code>{{ref|guess|a}}
| <code>685230</code>{{ref|guess|a}}
| <code>6.8523015e+5</code>{{ref|guess|a}}
| <code>"A to Z"</code><br><code>'A to Z'</code><br><code>NoSpaces</code>
| <pre>true
null
-42.1e7
"A to Z"</pre>
<code>(true, null, -42.1e7, "A to Z")</code>
|<pre>42
true
"A to Z"
1
2
3</pre>
<pre>42
true
"A to Z", (1, 2, 3)</pre>
|-
| [[OpenDDL]]
| <code>ref {null}</code>
| <code>bool {true}</code>
| <code>bool {false}</code>
| <code>int32 {685230}</code><br/><code>int32 {0x74AE}</code><br/><code>int32 {0b111010010101110}</code>
| <code>float {6.8523015e+5}</code>
| <code>string {"A to Z"}</code>
| Homogeneous array:
 
<pre>int32 {1, 2, 3, 4, 5}</pre>
 
Heterogeneous array:
 
<pre>array
{
bool {true}
ref {null}
float {-42.1e7}
string {"A to Z"}
}</pre>
| <pre>dict
{
value (key = "42") {bool {true}}
value (key = "A to Z") {int32 {1, 2, 3}}
}</pre>
|-
|[[PHP serialization format]]
|<code>N;</code>
|<code>b:1;</code>
|<code>b:0;</code>
|<code>i:685230;</code><br><code>i:-685230;</code>
|<code>d:685230.15;</code>{{ref|phpfloat|d}}<br><code>d:INF;</code><br><code>d:-INF;</code><br><code>d:NAN;</code>
|<code>s:6:"A to Z";</code>
|<code>a:4:{i:0;b:1;i:1;N;i:2;d:-421000000;i:3;s:6:"A to Z";}</code>
|Associative array:<br><code>a:2:{i:42;b:1;s:6:"A to Z";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}</code><br>Object:<br><code>O:8:"stdClass":2:{s:4:"John";d:3.14;s:4:"Jane";d:2.718;}</code>{{ref|phpfloat|d}}
|-
| [[Pickle (Python)]]
| <code>N.</code>
| <code>I01\n.</code>
| <code>I00\n.</code>
| <code>I685230\n.</code>
| <code>F685230.15\n.</code>
| <code>S'A to Z'\n.</code>
| <code>(lI01\na(laF-421000000.0\naS'A to Z'\na.</code>
| <code>(dI42\nI01\nsS'A to Z'\n(lI1\naI2\naI3\nas.</code>
|-
| [[Property list]]<br>(plain text format)<ref name="gnustep">{{cite web|url=http://www.gnustep.org/resources/documentation/Developer/Base/Reference/NSPropertyList.html|title=NSPropertyListSerialization class documentation|website=www.gnustep.org|access-date=2009-10-28|archive-url=https://web.archive.org/web/20110519164921/http://gnustep.org/resources/documentation/Developer/Base/Reference/NSPropertyList.html|archive-date=2011-05-19|url-status=dead}}</ref>
| {{n/a}}
| <code><*BY></code>
| <code><*BN></code>
| <code><*I685230></code>
| <code><*R6.8523015e+5></code>
| <code>"A to Z"</code>
| <code>( <*BY>, <*R-42.1e7>, "A to Z" )</code>
| <pre>{
"42" = <*BY>;
"A to Z" = ( <*I1>, <*I2>, <*I3> );
}</pre>
|-
| [[Property list]]<br>(XML format)<ref>{{cite web|url=https://developer.apple.com/library/archive/|title=Documentation Archive|website=developer.apple.com}}</ref>
| {{n/a}}
| <code><true /></code>
| <code><false /></code>
| <code><integer>685230</integer></code>
| <code><real>6.8523015e+5</real></code>
| {{nobr|<code><string>A to Z</string></code>}}
| <syntaxhighlight lang="xml"><array>
<true />
<real>-42.1e7</real>
<string>A to Z</string>
</array></syntaxhighlight>
| <syntaxhighlight lang="xml"><dict>
<key>42</key>
<true />
<key>A to Z</key>
<array>
<integer>1</integer>
<integer>2</integer>
<integer>3</integer>
</array>
</dict></syntaxhighlight>
|-
| [[Protocol Buffers]]
| {{n/a}}
| <code>true</code>
| <code>false</code>
| <code>685230</code><br><code>-685230</code>
| <code>20.0855369</code>
| <code>{{nobr|"A to Z"}}<br>{{nobr|"sdfff2 \000\001\002\377\376\375"}}<br>{{nobr|"q\tqq<>q2&\001\377"}}</code>
| <pre>field1: "value1"
field1: "value2"
field1: "value3
</pre>
<pre>anotherfield {
foo: 123
bar: 456
}
anotherfield {
foo: 222
bar: 333
}
</pre>
| <syntaxhighlight lang="protobuf">
thing1: "blahblah"
thing2: 18923743
thing3: -44
thing4 {
submessage_field1: "foo"
submessage_field2: false
}
enumeratedThing: SomeEnumeratedValue
thing5: 123.456
[extensionFieldFoo]: "etc"
[extensionFieldThatIsAnEnum]: EnumValue
</syntaxhighlight>
|-
| [[S-expression]]s
| <code>NIL</code><br><code>nil</code>
| <code>T</code><br><code>#t</code>{{ref|lispstd|f}}<br><code>true</code>
| <code>NIL</code><br><code>#f</code>{{ref|lispstd|f}}<br><code>false</code>
| <code>685230</code>
| <code>6.8523015e+5</code>
| <code>abc</code><br><code>"abc"</code><br><code>#616263#</code><br><code>3:abc</code><br><code>{MzphYmM=}</code><br><code><nowiki>|YWJj|</nowiki></code>
| <code>(T NIL -42.1e7 "A to Z")</code>
| <code>((42 T) ("A to Z" (1 2 3)))</code>
|-
| [[YAML]]
| <code>~</code><br><code>null</code><br><code>Null</code><br><code>NULL</code><ref>{{cite web|url=http://yaml.org/type/null.html |title=Null Language-Independent Type for YAML Version 1.1 |work=YAML.org
|date=2005-01-18 |author1=Oren Ben-Kiki|author2=Clark Evans|author3=Brian Ingerson |access-date=2009-09-12}}</ref>
| <code>y</code><br><code>Y</code><br><code>yes</code><br><code>Yes</code><br><code>YES</code><br><code>on</code><br><code>On</code><br><code>ON</code><br><code>true</code><br><code>True</code><br><code>TRUE</code><ref name="yamlbool">{{cite web|url=http://yaml.org/type/bool.html |title=Boolean Language-Independent Type for YAML Version 1.1 |publisher=Clark C. Evans |author1=Oren Ben-Kiki|author2=Clark Evans|author3=Brian Ingerson |work=YAML.org |date=2005-01-18 |access-date=2009-09-12}}</ref>
| <code>n</code><br><code>N</code><br><code>no</code><br><code>No</code><br><code>NO</code><br><code>off</code><br><code>Off</code><br><code>OFF</code><br><code>false</code><br><code>False</code><br><code>FALSE</code><ref name="yamlbool"/>
| <code>685230</code><br><code>+685_230</code><br><code>-685230</code><br><code>02472256</code><br><code>0x_0A_74_AE</code><br><code>0b1010_0111_0100_1010_1110</code><br><code>190:20:30</code><ref>{{cite web|url=http://yaml.org/type/int.html |title=Integer Language-Independent Type for YAML Version 1.1 |publisher=Clark C. Evans |author1=Oren Ben-Kiki|author2=Clark Evans|author3=Brian Ingerson |work=YAML.org |date=2005-02-11 |access-date=2009-09-12}}</ref>
|<code>6.8523015e+5</code><br><code>685.230_15e+03</code><br><code>685_230.15</code><br><code>190:20:30.15</code><br><code>.inf</code><br><code>-.inf</code><br><code>.Inf</code><br><code>.INF</code><br><code>.NaN</code><br><code>.nan</code><br><code>.NAN</code><ref>{{cite web|url=http://yaml.org/type/float.html |title=Floating-Point Language-Independent Type for YAML Version 1.1 |publisher=Clark C. Evans |author1=Oren Ben-Kiki|author2=Clark Evans|author3=Brian Ingerson |work=YAML.org |date=2005-01-18 |access-date=2009-09-12}}</ref>
| <code>A to Z</code><br><code>"A to Z"</code><br><code>'A to Z'</code>
| <code>[y, ~, -42.1e7, "A to Z"]</code>
<pre>- y
-
- -42.1e7
- A to Z</pre>
| <code>{"John":3.14, "Jane":2.718}</code>
<pre>42: y
A to Z: [1, 2, 3]</pre>
|-
| [[XML]]{{ref|xmlguess|e}} and [[SOAP]]
| {{nobr|<code><null /></code>{{ref|guess|a}}}}
| <code>true</code>
| <code>false</code>
| <code>685230</code>
| <code>6.8523015e+5</code>
| {{nobr|<code>A to Z</code>}}
|<syntaxhighlight lang="xml">
<item>true</item>
<item xsi:nil="true"/>
<item>-42.1e7</item>
<item>A to Z<item>
</syntaxhighlight>
|<syntaxhighlight lang="xml"><map>
<entry key="42">true</entry>
<entry key="A to Z">
<item val="1"/>
<item val="2"/>
<item val="3"/>
</entry>
</map></syntaxhighlight>
|-
| [[XML-RPC]]
|
| <code><value><boolean>1</boolean></value></code>
| <code><value><boolean>0</boolean></value></code>
| <code><value><int>685230</int></value></code>
| <code><value><double>6.8523015e+5</double></value></code>
| <code><value><string>A to Z</string></value></code>
|<syntaxhighlight lang="xml"><value><array>
<data>
<value><boolean>1</boolean></value>
<value><double>-42.1e7</double></value>
<value><string>A to Z</string></value>
</data>
</array></value></syntaxhighlight>
|<syntaxhighlight lang="xml"><value><struct>
<member>
<name>42</name>
<value><boolean>1</boolean></value>
</member>
<member>
<name>A to Z</name>
<value>
<array>
<data>
<value><int>1</int></value>
<value><int>2</int></value>
<value><int>3</int></value>
</data>
</array>
</value>
</member>
</struct></syntaxhighlight>
|}
{{sticky table end}}
{{ordered list
| list-style-type=lower-alpha
| {{note|guess}}Omitted XML elements are commonly decoded by [[XML data binding]] tools as NULLs. Shown here is another possible encoding; [[XML schema]] does not define an encoding for this datatype.
| {{note|csvguess}}The RFC CSV specification only deals with delimiters, newlines, and quote characters; it does not directly deal with serializing programming [[data structure]]s.
| {{note|netguess}}The [[netstring]]s specification only deals with nested [[byte string]]s; anything else is outside the scope of the specification.
| {{note|phpfloat}}PHP will unserialize any floating-point number correctly, but will serialize them to their full decimal expansion. For example, 3.14 will be serialized to {{val|3.140000000000000124344978758017532527446746826171875}}.
| {{note|xmlguess}}[[XML data binding]]s and [[SOAP]] serialization tools provide type-safe XML serialization of programming [[data structure]]s into XML. Shown are XML values that can be placed in XML elements and attributes.
| {{note|lispstd}}This syntax is not compatible with the Internet-Draft, but is used by some dialects of [[Lisp (programming language)|Lisp]].
}}
 
*{{note|plist DTD|p}} The XML encoding has a [http://www.apple.com/DTDs/PropertyList-1.0.dtd public DTD] from Apple
*{{note|binogdl|o}} [http://ogdl.sourceforge.net/spec/ogdl-b.htm OGDL Binary 1.0 Working draft]
*{{ref|plistbin|b}} Its default encoding is binary.
*{{ref|plisttext|t}} An XML encoding is supported.
 
==Comparison of binary formats==
==Advantages==
<!--This table is meant to describe how the various datatypes are encoded in binary in the various formats.-->
* XML provides a basic syntax that can be used to share information between different kinds of computers, different applications, and different organizations. XML data is stored in plain text format.<ref name="w3chowxmluse">{{cite web|url=http://www.w3schools.com/Xml/xml_usedfor.asp |title=How Can XML be Used? |publisher=W3schools.com |date= |accessdate=2009-07-31}}</ref> This software- and hardware-independent way of storing data allows different incompatible systems to share data without needing to pass them through many layers of conversion. This also makes it easier to expand or upgrade to new operating systems, new applications, or new browsers, without losing any data.
* It supports [[Unicode]], allowing almost any information in any written human language to be communicated.
* It can represent common [[computer science]] [[data structure]]s: [[record (computer science)|record]]s, [[List (computing)|list]]s and [[tree data structure|tree]]s.
* Its [[self-documenting]] format describes [[structure]] and [[field name]]s as well as specific values.
* The strict [[syntax]] and [[parsing]] requirements make the necessary [[parser|parsing algorithms]] extremely simple, efficient, and consistent.
* Content-based XML markup enhances searchability, making it possible for agents and search engines to categorize data instead of wasting processing power on context-based full-text searches.
* The [[hierarchy|hierarchical]] structure is suitable for most (but not all) types of documents.
* It is platform-independent, thus relatively immune to changes in technology.
* Its predecessor, [[SGML]], has been in use since 1986, so there is extensive experience and software available.
 
{{sticky table start}}
==Disadvantages==
{| class="wikitable sortable sort-under sticky-table-head sticky-table-col1" style="font-size:75%"
* XML syntax is redundant or large relative to binary representations of similar data,<ref name="Elliotte001">
|- style="vertical-align:bottom;"
{{cite book
! Format
| last = Harold
! [[Nullable type|Null]]
| first = Elliotte Rusty
! [[Boolean data type|Boolean]]s
| title = Processing XML with Java(tm): a guide to SAX, DOM, JDOM, JAXP, and TrAX
! [[Integer (computer science)|Integer]]
| publisher = Addison-Wesley
! [[Floating-point]]
| year = 2002
! [[String (computer science)|String]]
| isbn = 0201771861
! [[Array (data type)|Array]]
| ref = Reference-Rusty-2002-a
! [[Associative array]]/[[object (computer science)|object]]
}}XML documents are too verbose compared with binary equivalents.</ref> especially with [[Table (information)|tabular]] data.
|- style="vertical-align:top;"
* The redundancy may affect application efficiency through higher storage, transmission and processing costs.<ref name="Elliotte000">
| [[ASN.1]]<br>([[Basic Encoding Rules|BER]], [[Packed Encoding Rules|PER]] or [[Octet encoding rules|OER]] encoding)
{{cite book
| {{mono|NULL}} type
| last = Harold
| {{mono|BOOLEAN}}: {{ubli
| first = Elliotte Rusty
| BER: as 1 byte in binary form;
| title = XML in a Nutshell: A Desktop Quick Reference
| PER: as 1 bit;
| publisher = O'Reilly
| yearOER: as 1 = 2002byte
}}
| isbn = 0596002920
| {{mono|INTEGER}}: {{ubli
| ref = Reference-Rusty-2002-b
| BER: variable-length big-endian binary representation (up to 2{{sup|2{{sup|1024}}}} bits);
}} XML documents are very verbose and searching is inefficient for
| PER Unaligned: a fixed number of bits if the integer type has a finite range; a variable number of bits otherwise;
high-performance largescale database applications.</ref><ref name="However000">However, the [[Binary XML]] effort strives to alleviate these problems by using a binary representation for the XML document. For example, the [[Java (programming language)|Java]] reference implementation of the [[Fast Infoset]] standard parsing speed is better by a factor 10 compared to [[Java (programming language)|Java]] [[Xerces]], and by a factor 4 compared to the [http://piccolo.sourceforge.net/ Piccolo driver], one of the fastest Java-based XML parser [https://fi.dev.java.net/reports/parsing/report.html].</ref>
| PER Aligned: a fixed number of bits if the integer type has a finite range and the size of the range is less than 65536; a variable number of octets otherwise;
* XML syntax is verbose, especially for human readers, relative to other alternative 'text-based' data transmission formats.<ref name="Bierman000">
| OER: 1, 2, or 4 octets (either signed or unsigned) if the integer type has a finite range that fits in that number of octets; a variable number of octets otherwise
{{cite book
}}
| last = Bierman
| {{mono|REAL}}:{{ubli
| first = Gavin
| base-10 real values are represented as character strings in ISO 6093 format;
| title = Database Programming Languages: 10th international symposium, DBPL 2005 Trondheim, Norway
| binary real values are represented in a binary format that includes the mantissa, the base (2, 8, or 16), and the exponent;
| publisher = Springer
| the special values {{mono|NaN, -INF, +INF}}, and negative zero are also supported
| year = 2005
}}
| isbn = 3540309519
| Multiple valid types ({{mono|VisibleString, PrintableString, GeneralString, UniversalString, UTF8String}})
}}XML syntax is too verbose for human readers in for certain applications.
| Data specifications {{mono|SET OF}} (unordered) and {{mono|SEQUENCE OF}} (guaranteed order)
Proposes a dual syntax for human readability.</ref><ref name="VerbRebut000">Although many purportedly
| User definable type
"less verbose" text formats actually cite XML as
|- style="vertical-align:top;"
both inspiration and prior art.
| [[BSON]]
See e.g., http://yaml.org/spec/current.html,
| <code>\x0A</code><br>(1 byte)
http://innig.net/software/sweetxml/index.html,
| True: <code>\x08\x01</code><br>False: <code>\x08\x00</code><br>(2 bytes)
http://www.json.org/xml.html.</ref>
| int32: 32-bit [[little-endian]] [[2's complement]] or int64: 64-bit [[little-endian]] [[2's complement]]
* The [[hierarchical model]] for representation is limited in comparison to an [[object oriented]] [[Graph (mathematics)|graph]].<ref name="TreeLimit000">A hierarchical model only gives a fixed, monolithic view of the [[tree structure]]. For example, either actors under movies, or movies under actors, but not both.</ref><ref name="Lim000">
| [[Double-precision floating-point format|Double]]: [[little-endian]] [[binary64]]
{{cite book
| [[UTF-8]]-encoded, preceded by int32-encoded string length in bytes
| last = Lim
| [[BSON]] embedded document with numeric keys
| first = Ee-Peng
| [[BSON]] embedded document
| title = Digital Libraries: People, Knowledge, and Technology
|- style="vertical-align:top;"
| publisher = Springer
| [[CBOR|Concise Binary Object Representation]] (CBOR)
| year = 2002
| <code>\xf6</code><br>(1 byte)
| isbn = 3540002618
| {{ubli
}}Discusses some of the limitation with fixed hierarchy. Proceedings of the 5th International Conference on Asian Digital Libraries, ICADL 2002, held in Singapore in December 2002. </ref>
| True: <code>\xf5</code>
* Expressing overlapping (non-hierarchical) node relationships requires extra effort.<ref name="Searle000">{{cite book
| False: <code>\xf4</code>
| last = Searle
}}
| first = Leroy F.
(1 byte)
| title = Voice, text, hypertext: emerging practices in textual studies
| {{ubli
| publisher = University of Washington Press
| Small positive/negative <code>\x00</code>–<code>\x17</code> & <code>\x20</code>–<code>\x37</code> (1 byte)
| year = 2004
| 8-bit: positive <code>\x18</code>, negative <code>\x38</code> (+ 1 byte)
| isbn = 0295983051
| 16-bit: positive <code>\x19</code>, negative <code>\x39</code> (+ 2 bytes)
}} Proposes an alternative system for encoding overlapping elements. </ref>
| 32-bit: positive <code>\x1A</code>, negative <code>\x3A</code> (+ 4 bytes)
* XML namespaces are problematic to use and namespace support can be difficult to correctly implement in an XML parser.<ref name="Names000">(See e.g., http://www-128.ibm.com/developerworks/library/x-abolns.html )</ref>
| 64-bit: positive <code>\x1B</code>, negative <code>\x3B</code> (+ 8 bytes)
* XML is commonly depicted as "[[self-documenting]]" but this depiction ignores critical ambiguities.<ref name="selfdesc000">{{cite web
| Negative x encoded as (−x − 1)
| title = The Myth of Self-Describing XML
}}
| url = http://www.oceaninformatics.biz/publications/e2.pdf
| {{ubli
|format=PDF| accessdate = 2007-05-12
| IEEE half/single/double <code>\xf9</code>–<code>\xfb</code> (+ 2–8 bytes)
}}</ref><ref>(See e.g., [[Use–mention distinction]], [[Naming collision]], [[Polysemy]])</ref>
| Decimals and bigfloats (4+ bytes) encoded as <code>\xc4</code> tag + 2-item array of integer mantissa & exponent
* The distinction between content and attributes in XML seems unnatural to some and makes designing XML data structures harder.<ref name="XMLSuck8">{{cite web
}}
| title = Does XML Suck?
| {{ubli
| url = http://xmlsucks.org/but_you_have_to_use_it_anyway/does-xml-suck.html
| Length and content (1–9 bytes overhead)
| accessdate = 2007-12-15
| Bytestring <code>\x40</code>–<code>\x5f</code>
}}(See "8. Complexity: Attributes and Content")</ref>
| [[UTF-8]] <code>\x60</code>–<code>\x7f</code>
* Transformations, even identity transforms, result in changes to format (whitespace, attribute ordering, attribute quoting, whitespace around attributes, newlines). These problems can make [[diff]]-ing the XML source very difficult except via [[Canonical XML]].
| Indefinite partial strings <code>\x5f</code> and <code>\x7f</code> stitched together until <code>\xff</code>.
* XML encourages the use of non-relational data structures (data non-normalized).
}}
| {{ubli
| Length and items <code>\x80</code>–<code>\x9e</code>
| Indefinite list <code>\x9f</code> terminated by <code>\xff</code> entry.
}}
| {{ubli
| Length (in pairs) and items <code>\xa0</code>–<code>\xbe</code>
| Indefinite map <code>\xbf</code> terminated by <code>\xff</code> key.
}}
|- style="vertical-align:top;"
| [[Efficient XML Interchange|Efficient XML Interchange (EXI)]]{{efn |group=binary |Any XML based representation can be compressed, or generated as, using EXI {{ndash}} {{Cite web |title=Efficient XML Interchange (EXI) Format 1.0 (Second Edition) |url=https://www.w3.org/TR/2014/REC-exi-20140211/Overview.html}}<ref>{{Cite web |title=Efficient Extensible Interchange |url=https://www.w3.org/XML/EXI/index.html}}</ref> {{ndash}} which is a "Schema Informed" (as opposed to schema-required, or schema-less) binary compression standard for XML.}}<br>
(Unpreserved lexical values format)
| xsi:nil is not allowed in binary context.
| 1–2 bit integer interpreted as boolean.
| Boolean sign, plus arbitrary length 7-bit octets, parsed until most-significant bit is 0, in little-endian. The schema can set the zero-point to any arbitrary number.<br>
Unsigned skips the boolean flag.
| {{ubli
| Float: integer mantissa and integer exponent.
| Decimal: boolean sign, integer whole value, integer fractional.
}}
| Length prefixed integer-encoded Unicode. Integers may represent enumerations or string table entries instead.
| Length prefixed set of items.
| {{No|Not in protocol.}}
|- style="vertical-align:top;"
| [[FlatBuffers]]
| Encoded as absence of field in parent object
| {{ubli
| True: <code>\x01</code>
| False: <code>\x00</code>
}}
(1 byte)
| [[Little-endian]] [[2's complement]] signed and unsigned 8/16/32/64 bits
| {{ubli
| [[Single-precision floating-point format|Floats]]: [[little-endian]] [[binary32]]
| [[Double-precision floating-point format|Doubles]]: [[little-endian]] [[binary64]]
}}
| [[UTF-8]]-encoded, preceded by 32-bit integer length of string in bytes
| Vectors of any other type, preceded by 32-bit integer length of number of elements
| Tables (schema defined types) or Vectors sorted by key (maps / dictionaries)
|- style="vertical-align:top;"
| [[Ion (serialization format)|Ion]]<ref>[http://amzn.github.io/ion-docs/docs/binary.html Ion Binary Encoding]</ref>
| <code>\x0f</code>{{efn |group=binary |All basic Ion types have a null variant, as its 0xXf tag. Any tag beginning with 0x0X other than 0x0f defines ignored padding.}}
| {{ubli
| True: <code>\x11</code>
| False: <code>\x10</code>
}}
| {{ubli
| Positive <code>\x2x</code>, negative <code>\x3x</code>
| Zero is always encoded in tag byte.
| BigInts over 13 bytes (104 bits) have 1+ byte overhead for length
}}
| {{ubli
| <code>\x44</code> (32-bit float)
| <code>\x48</code> (64-bit float)
| Zero is always encoded in tag byte.
}}
| {{ubli
| [[UTF-8]]: <code>\x8x</code>
| Other strings: <code>\x9x</code>
| Arbitrary length and overhead
}}
| <code>\xbx</code> Arbitrary length and overhead. Length in octets.
| {{ubli
| Structs (numbered fields): <code>\xdx</code>
| Annotations (named fields): <code>\xex</code>
}}
|- style="vertical-align:top;"
| [[MessagePack]]
| <code>\xc0</code>
| {{ubli
| True: <code>\xc3</code>
| False: <code>\xc2</code>
}}
| {{ubli
| Single byte "fixnum" (values {{nowrap|−32 – 127}})
| ''or'' typecode (1 byte) + big-endian (u)int8/16/32/64
}}
| Typecode (1 byte) + IEEE single/double
| {{ubli
| Typecode + up to 15 bytes
| ''or'' typecode + length as uint8/16/32 + bytes;
}}
encoding is unspecified<ref>{{cite web|url=https://github.com/msgpack/msgpack|title=MessagePack is an extremely efficient object serialization library. It's like JSON, but very fast and small.: msgpack/msgpack|date=2 April 2019|via=GitHub}}</ref>
| {{ubli
| As "fixarray" (single-byte prefix + up to 15 array items)
| ''or'' typecode (1 byte) + 2–4 bytes length + array items
}}
| {{ubli
| As "fixmap" (single-byte prefix + up to 15 key-value pairs)
| ''or'' typecode (1 byte) + 2–4 bytes length + key-value pairs
}}
|- style="vertical-align:top;"
| [[Netstring]]s{{efn |group=binary |Interpretation of Netstrings is entirely application- or schema-dependent.}}
| {{No|Not in protocol.}}
| {{No|Not in protocol.}}
| {{No|Not in protocol.}}
| {{No|Not in protocol.}}
| Length-encoded as an ASCII string + ':' + data + ','<br>
Length counts only octets between ':' and ','
| {{No|Not in protocol.}}
| {{No|Not in protocol.}}
|- style="vertical-align:top;"
| [[OGDL]] Binary
|
|
|
|
|
|
|
|- style="vertical-align:top;"
| [[Property list]]<br>(binary format)
|
|
|
|
|
|
|
|- style="vertical-align:top;"
| [[Protocol Buffers]]
|
|
| {{ubli
| Variable encoding length signed 32-bit: varint encoding of "ZigZag"-encoded value <code>(n << 1) [[XOR]] (n >> 31)</code>
| Variable encoding length signed 64-bit: varint encoding of "ZigZag"-encoded <code>(n << 1) XOR (n >> 63)</code>
| Constant encoding length 32-bit: 32 bits in [[little-endian]] [[2's complement]]
| Constant encoding length 64-bit: 64 bits in [[little-endian]] [[2's complement]]
}}
| {{ubli
| [[Single-precision floating-point format|Floats]]: [[little-endian]] [[binary32]]
| [[Double-precision floating-point format|Doubles]]: [[little-endian]] [[binary64]]
}}
| [[UTF-8]]-encoded, preceded by varint-encoded integer length of string in bytes
| Repeated value with the same tag or, for varint-encoded integers only, values packed contiguously and prefixed by tag and total byte length
| {{n/a}}
|- style="vertical-align:top;"
| [[Smile (data interchange format)|Smile]]
| <code>\x21</code>
| {{ubli
| True: <code>\x23</code>
| False: <code>\x22</code>
}}
| {{ubli
| Single byte "small" (values {{nowrap|−16 – 15}} encoded as {{nowrap|<code>\xc0</code>–<code>\xdf</code>}}),
| zigzag-encoded <code>varint</code>s (1–11 data bytes), or <code>BigInteger</code>
}}
| IEEE single/double, <code>BigDecimal</code>
| Length-prefixed "short" Strings (up to 64 bytes), marker-terminated "long" Strings and (optional) back-references
| Arbitrary-length heterogenous arrays with end-marker
| Arbitrary-length key/value pairs with end-marker
|- style="vertical-align:top;"
| [[SDXF|Structured Data eXchange Formats]] (SDXF)
|
|
| Big-endian signed 24-bit or 32-bit integer
| Big-endian IEEE double
| Either [[UTF-8]] or ISO 8859-1 encoded
| List of elements with identical ID and size, preceded by array header with int16 length
| Chunks can contain other chunks to arbitrary depth.
|- style="vertical-align:top;"
| [[Thrift (protocol)|Thrift]]
|
|
|
|
|
|
|
|}
 
{{sticky table end}}
== Notes ==
{{notelist|group=binary}}
{{reflist|2}}
 
==See also==
*[[Comparison of document markup languages]]
 
==References==
{{reflist}}
*[http://www.w3.org/TR/NOTE-xml-ql/ XML-QL Proposal discussing XML benefits],
 
*[http://www.25hoursaday.com/weblog/PermaLink.aspx?guid=dada27bf-2af0-400d-94c9-5575546f5664 When to use XML],
==External links==
*[http://c2.com/cgi/wiki?XmlSucks "XML Sucks" on c2.com], [http://www.xml.com/pub/a/2001/05/02/champion.html Daring to Do Less with XML])
*[https://www.w3.org/TR/NOTE-xml-ql/ XML-QL Proposal discussing XML benefits]
*[https://www.xml.com/pub/a/2001/05/02/champion.html Daring to Do Less with XML]
 
[[Category:Data serialization formats]]
[[Category:Persistence]]
[[Category:Computing comparisons|Data-serialization formats]]