Comparison of data-serialization formats

{{Short description|None}}

This is a comparison of data serialization formats, various ways to convert complex objects to sequences of bits. It does not include markup languages used exclusively as document file formats.

Overview

{{sort-under}}

class="wikitable sortable sort-under mw-collapsible"
Name

! Creator-maintainer

! Based on

! Standardized?{{definition needed|date=January 2021}}

! Specification

! Binary?

! Human-readable?

! Supports references?{{ref|stdrefs|e}}

! Schema-IDL?

! Standard APIs

! 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 Parquet]

| {{yes}}

| {{no}}

| {{no}}

| {{n/a}}

| Java, Python, C++

| {{no}}

Apache Thrift

| Facebook (creator)
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[https://thrift.apache.org/ Apache Thrift]

| {{n/a}}

ASN.1

| ISO, 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|BER, DER, PER, OER, or custom via ECN}}

| {{yes|XER, JER, GSER, or custom via ECN}}

| {{yes}}{{ref|asn1refs|f}}

| {{yes|Built-in}}

| {{n/a}}

| {{yes|OER}}

Bencode

| Bram Cohen (creator)
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, P. Hoffman

| MessagePack{{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}}

| {{yes}}

| RFC 8949

| {{yes}}

| {{no}}

| {{yes}},
through tagging

| {{yes|[https://tools.ietf.org/html/rfc8610 CDDL]}}

| {{yes|FIDO2}}

| {{no}}

Comma-separated values (CSV)

| RFC author:
Yakov Shafranovich

| {{n/a}}

| {{partial|Myriad informal variants}}

| RFC 4180
(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}}
(Signature strings)

| {{yes|Yes}}

| {{n/a}}

Efficient XML Interchange (EXI)

| 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}}

| {{Yes|DOM, 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{{cite web|url=https://github.com/edn-format/edn/wiki/Implementations|title=Implementations|website=GitHub }}

| {{no}}

FlatBuffers

| Google

| {{n/a}}

| {{no}}

| [https://google.github.io/flatbuffers/ Flatbuffers GitHub]

| {{yes}}

| {{yes|Apache Arrow}}

| {{partial}}
(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

| ISO, IEC, ITU-T

| XML

| {{yes}}

| ITU-T X.891 and ISO/IEC 24824-1:2007

| {{yes}}

| {{no}}

| {{yes|XPointer, XPath}}

| {{yes|XML schema}}

| {{yes|DOM, SAX, XQuery, XPath}}

| {{n/a}}

FHIR

| Health Level 7

| REST basics

| {{Yes}}

| Fast Healthcare Interoperability Resources

| {{Yes}}

| {{Yes}}

| {{Yes}}

| {{Yes}}

| Hapi for FHIR{{cite web|url=http://hapifhir.io/|title=HAPI FHIR - The Open Source FHIR API for Java|website=hapifhir.io}} JSON, XML, Turtle

| {{no}}

Ion

| 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 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

| {{yes}}

| [https://tools.ietf.org/html/std90 STD 90]/RFC 8259
(ancillary:
RFC 6901,
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, 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}}
([http://json-schema.org/ JSON Schema Proposal], ASN.1 with 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}}
([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}}

| {{no}}

| {{no}}

| {{yes}}

Netstrings

| 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}}

| {{no}}

| [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-UA Binary

| OPC Foundation

| {{n/a}}

| {{no}}

| [https://opcfoundation.org opcfoundation.org]

| {{yes}}

| {{no}}

| {{yes}}

| {{no}}

| {{no}}

| {{n/a}}

OpenDDL

| Eric Lengyel

| 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

| {{yes|De facto as PEPs}}

| [https://www.python.org/dev/peps/pep-3154/ PEP 3154 – Pickle protocol version 4]

| {{yes}}

| {{no}}

| {{yes}}[https://github.com/python/cpython/blob/v3.9.0/Lib/pickle.py#L137-L144 cpython/Lib/pickle.py]

| {{no}}

| {{yes}}

| {{no}}

Property list

| NeXT (creator)
Apple (maintainer)

| {{dunno}}

| {{partial}}

| [https://www.apple.com/DTDs/PropertyList-1.0.dtd Public DTD for XML format]

| {{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-expressions}}

| John McCarthy (original)
Ron Rivest (internet draft)

| Lisp, Netstrings

| {{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}}

|

| {{n/a}}

Smile

| Tatu Saloranta

| JSON

| {{no}}

| [https://github.com/FasterXML/smile-format-specification Smile Format Specification]

| {{yes}}

| {{no}}

| {{yes}}

| {{partial}}
([http://json-schema.org/ JSON Schema Proposal], other JSON schemas/IDLs)

| {{partial}}
(via JSON APIs implemented with Smile backend, on Jackson, Python)

| {{n/a}}

SOAP

| W3C

| XML

| {{yes}}

| {{nobr|W3C Recommendations:}}
[https://www.w3.org/TR/2000/NOTE-SOAP-20000508/ SOAP/1.1]
[https://www.w3.org/TR/soap12/ SOAP/1.2]

| {{partial}}
({{nobr|Efficient XML Interchange}}, {{nobr|Binary XML}}, {{nobr|Fast Infoset}}, MTOM, {{nobr|XSD base64 data}})

| {{yes}}

| {{yes|Built-in id/ref, XPointer, XPath}}

| {{yes|WSDL, XML schema}}

| {{yes|DOM, SAX, XQuery, XPath}}

| {{n/a}}

{{nobr|Structured Data eXchange Formats}}

| 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 (XDR)

| Sun Microsystems (creator)
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

| {{yes}}

| {{nobr|W3C Recommendations:}}
[http://www.w3.org/TR/2008/REC-xml-20081126/ 1.0 (Fifth Edition)]
[http://www.w3.org/TR/2006/REC-xml11-20060816/ 1.1 (Second Edition)]

| {{partial}}
({{nobr|Efficient XML Interchange}}, {{nobr|Binary XML}}, {{nobr|Fast Infoset}}, {{nobr|XSD base64 data}})

| {{yes}}

| {{yes|XPointer, XPath}}

| {{yes|XML schema, RELAX NG}}

| {{yes|DOM, SAX, XQuery, XPath}}

| {{n/a}}

XML-RPC

| Dave Winer{{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}}

| XML

| {{no}}

| [http://xmlrpc.com/spec.md XML-RPC Specification]

| {{no}}

| {{yes}}

| {{no}}

| {{no}}

| {{no}}

| {{no}}

YAML

| Clark Evans,
Ingy döt Net,
and Oren Ben-Kiki

| C, Java, Perl, Python, Ruby, Email, HTML, MIME, URI, XML, SAX, SOAP, JSON{{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}}

| {{no}}

| [http://www.yaml.org/spec/1.2/spec.html Version 1.2]

| {{no}}

| {{yes}}

| {{yes}}

| {{partial}}
([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?

! Human-readable?

! Supports references?{{ref|stdrefs|e}}

! Schema-IDL?

! Standard APIs

! Supports zero-copy operations

{{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.{{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}}{{cite web|url=https://developers.google.com/protocol-buffers/docs/proto3#json|title=JSON Mapping - Protocol Buffers|website=Google Developers}}

| {{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 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 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.{{cite web|url=https://avro.apache.org/docs/1.9.2/spec.html#json_encoding|title=Avro Json Format}}

| {{note|capnptextformat}}The primary format is binary, but a text format is available.

}}

Syntax comparison of human-readable formats

class="wikitable"
Format

! Null

! Boolean true

! Boolean false

! Integer

! Floating-point

! String

! Array

! Associative array/Object

ASN.1
(XML Encoding Rules)

| {{nobr|}}

| true

| false

| 685230

| 6.8523015e+5

| {{nobr|A to Z}}

|

true

-42.1e7

A to Z

We said, "no".

| An object (the key is a field name):

true

1.85

Bob Peterson

A data mapping (the key is a data value):

John

3.14

Jane

2.718

{{ref|guess|a}}

CSV{{ref|csvguess|b}}

| null{{ref|guess|a}}
(or an empty element in the row){{ref|guess|a}}

| 1{{ref|guess|a}}
true{{ref|guess|a}}

| 0{{ref|guess|a}}
false{{ref|guess|a}}

| 685230
-685230{{ref|guess|a}}

| 6.8523015e+5{{ref|guess|a}}

| {{nobr|A to Z}}
{{nobr|"We said, ""no""."}}

| true,,-42.1e7,"A to Z"

|

42,1

A to Z,1,2,3

edn

| nil

| true

| false

| 685230
-685230

| 6.8523015e+5

| "A to Z", "A \"up to\" Z"

| [true nil -42.1e7 "A to Z"]

| {:kw 1, "42" true, "A to Z" [1 2 3]}

Format

! Null

! Boolean true

! Boolean false

! Integer

! Floating-point

! String

! Array

! Associative array/Object

Ion

|

null

null.null

null.bool

null.int

null.float

null.decimal

null.timestamp

null.string

null.symbol

null.blob

null.clob

null.struct

null.list

null.sexp

| true

| false

| 685230
-685230
0xA74AE
0b111010010101110

| 6.8523015e5

| "A to Z"


A
to
Z

|

[true, null, -42.1e7, "A to Z"]

|

{'42': true, 'A to Z': [1, 2, 3]}

Netstrings{{ref|netguess|c}}

| 0:,{{ref|guess|a}}
4:null,{{ref|guess|a}}

| 1:1,{{ref|guess|a}}
4:true,{{ref|guess|a}}

| 1:0,{{ref|guess|a}}
5:false,{{ref|guess|a}}

| 6:685230,{{ref|guess|a}}

| 9:6.8523e+5,{{ref|guess|a}}

| {{nobr|6:A to Z,}}

| 29:4:true,0:,7:-42.1e7,6:A to Z,,

| {{nobr|41:9:2:42,1:1,,25:6:A to Z,12:1:1,1:2,1:3,,,,}}{{ref|guess|a}}

JSON

| null

| true

| false

| 685230
-685230

| 6.8523015e+5

| {{nobr|"A to Z"}}

|

[true, null, -42.1e7, "A to Z"]

|

{"42": true, "A to Z": [1, 2, 3]}

OGDL{{Verify source|date=September 2009}}

| null{{ref|guess|a}}

| true{{ref|guess|a}}

| false{{ref|guess|a}}

| 685230{{ref|guess|a}}

| 6.8523015e+5{{ref|guess|a}}

| "A to Z"
'A to Z'
NoSpaces

|

true

null

-42.1e7

"A to Z"

(true, null, -42.1e7, "A to Z")

|

42

true

"A to Z"

1

2

3

42

true

"A to Z", (1, 2, 3)

Format

! Null

! Boolean true

! Boolean false

! Integer

! Floating-point

! String

! Array

! Associative array/Object

OpenDDL

| ref {null}

| bool {true}

| bool {false}

| int32 {685230}
int32 {0x74AE}
int32 {0b111010010101110}

| float {6.8523015e+5}

| string {"A to Z"}

| Homogeneous array:

int32 {1, 2, 3, 4, 5}

Heterogeneous array:

array

{

bool {true}

ref {null}

float {-42.1e7}

string {"A to Z"}

}

|

dict

{

value (key = "42") {bool {true}}

value (key = "A to Z") {int32 {1, 2, 3}}

}

PHP serialization format

|N;

|b:1;

|b:0;

|i:685230;
i:-685230;

|d:685230.15;{{ref|phpfloat|d}}
d:INF;
d:-INF;
d:NAN;

|s:6:"A to Z";

|a:4:{i:0;b:1;i:1;N;i:2;d:-421000000;i:3;s:6:"A to Z";}

|Associative array:
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;}}
Object:
O:8:"stdClass":2:{s:4:"John";d:3.14;s:4:"Jane";d:2.718;}{{ref|phpfloat|d}}

Pickle (Python)

| N.

| I01\n.

| I00\n.

| I685230\n.

| F685230.15\n.

| S'A to Z'\n.

| (lI01\na(laF-421000000.0\naS'A to Z'\na.

| (dI42\nI01\nsS'A to Z'\n(lI1\naI2\naI3\nas.

Property list
(plain text format){{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}}

| {{n/a}}

| <*BY>

| <*BN>

| <*I685230>

| <*R6.8523015e+5>

| "A to Z"

| ( <*BY>, <*R-42.1e7>, "A to Z" )

|

{

"42" = <*BY>;

"A to Z" = ( <*I1>, <*I2>, <*I3> );

}

Property list
(XML format){{cite web|url=https://developer.apple.com/library/archive/|title=Documentation Archive|website=developer.apple.com}}

| {{n/a}}

|

|

| 685230

| 6.8523015e+5

| {{nobr|A to Z}}

|

-42.1e7

A to Z

|

42

A to Z

1

2

3

Protocol Buffers

| {{n/a}}

| true

| false

| 685230
-685230

| 20.0855369

| {{nobr|"A to Z"}}
{{nobr|"sdfff2 \000\001\002\377\376\375"}}
{{nobr|"q\tqq<>q2&\001\377"}}

|

field1: "value1"

field1: "value2"

field1: "value3

anotherfield {

foo: 123

bar: 456

}

anotherfield {

foo: 222

bar: 333

}

|

thing1: "blahblah"

thing2: 18923743

thing3: -44

thing4 {

submessage_field1: "foo"

submessage_field2: false

}

enumeratedThing: SomeEnumeratedValue

thing5: 123.456

[extensionFieldFoo]: "etc"

[extensionFieldThatIsAnEnum]: EnumValue

Format

! Null

! Boolean true

! Boolean false

! Integer

! Floating-point

! String

! Array

! Associative array/Object

S-expressions

| NIL
nil

| T
#t{{ref|lispstd|f}}
true

| NIL
#f{{ref|lispstd|f}}
false

| 685230

| 6.8523015e+5

| abc
"abc"
#616263#
3:abc
{MzphYmM=}
|YWJj|

| (T NIL -42.1e7 "A to Z")

| ((42 T) ("A to Z" (1 2 3)))

YAML

| ~
null
Null
NULL{{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}}

| y
Y
yes
Yes
YES
on
On
ON
true
True
TRUE{{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}}

| n
N
no
No
NO
off
Off
OFF
false
False
FALSE

| 685230
+685_230
-685230
02472256
0x_0A_74_AE
0b1010_0111_0100_1010_1110
190:20:30{{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}}

|6.8523015e+5
685.230_15e+03
685_230.15
190:20:30.15
.inf
-.inf
.Inf
.INF
.NaN
.nan
.NAN{{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}}

| A to Z
"A to Z"
'A to Z'

| [y, ~, -42.1e7, "A to Z"]

- y

-

- -42.1e7

- A to Z

| {"John":3.14, "Jane":2.718}

42: y

A to Z: [1, 2, 3]

XML{{ref|xmlguess|e}} and SOAP

| {{nobr|{{ref|guess|a}}}}

| true

| false

| 685230

| 6.8523015e+5

| {{nobr|A to Z}}

|

true

-42.1e7

A to Z

|

true

XML-RPC

|

| 1

| 0

| 685230

| 6.8523015e+5

| A to Z

|

1

-42.1e7

A to Z

|

42

1

A to Z

1

2

3

{{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 structures.

| {{note|netguess}}The netstrings specification only deals with nested byte strings; 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 bindings and SOAP serialization tools provide type-safe XML serialization of programming data structures 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.

}}

Comparison of binary formats

class="wikitable"
style="vertical-align:bottom;"

! Format

! Null

! Booleans

! Integer

! Floating-point

! String

! Array

! Associative array/object

style="vertical-align:top;"

| ASN.1
(BER, PER or OER encoding)

| {{mono|NULL}} type

| {{mono|BOOLEAN}}: {{ubli

| BER: as 1 byte in binary form;

| PER: as 1 bit;

| OER: as 1 byte

}}

| {{mono|INTEGER}}: {{ubli

| BER: variable-length big-endian binary representation (up to 2{{sup|2{{sup|1024}}}} bits);

| PER Unaligned: a fixed number of bits if the integer type has a finite range; a variable number of bits otherwise;

| 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;

| 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

}}

| {{mono|REAL}}:{{ubli

| base-10 real values are represented as character strings in ISO 6093 format;

| binary real values are represented in a binary format that includes the mantissa, the base (2, 8, or 16), and the exponent;

| the special values {{mono|NaN, -INF, +INF}}, and negative zero are also supported

}}

| Multiple valid types ({{mono|VisibleString, PrintableString, GeneralString, UniversalString, UTF8String}})

| Data specifications {{mono|SET OF}} (unordered) and {{mono|SEQUENCE OF}} (guaranteed order)

| User definable type

style="vertical-align:top;"

| BSON

| \x0A
(1 byte)

| True: \x08\x01
False: \x08\x00
(2 bytes)

| int32: 32-bit little-endian 2's complement or int64: 64-bit little-endian 2's complement

| Double: little-endian binary64

| UTF-8-encoded, preceded by int32-encoded string length in bytes

| BSON embedded document with numeric keys

| BSON embedded document

style="vertical-align:top;"

| Concise Binary Object Representation (CBOR)

| \xf6
(1 byte)

| {{ubli

| True: \xf5

| False: \xf4

}}

(1 byte)

| {{ubli

| Small positive/negative \x00\x17 & \x20\x37 (1 byte)

| 8-bit: positive \x18, negative \x38 (+ 1 byte)

| 16-bit: positive \x19, negative \x39 (+ 2 bytes)

| 32-bit: positive \x1A, negative \x3A (+ 4 bytes)

| 64-bit: positive \x1B, negative \x3B (+ 8 bytes)

| Negative x encoded as (−x − 1)

}}

| {{ubli

| IEEE half/single/double \xf9\xfb (+ 2–8 bytes)

| Decimals and bigfloats (4+ bytes) encoded as \xc4 tag + 2-item array of integer mantissa & exponent

}}

| {{ubli

| Length and content (1–9 bytes overhead)

| Bytestring \x40\x5f

| UTF-8 \x60\x7f

| Indefinite partial strings \x5f and \x7f stitched together until \xff.

}}

| {{ubli

| Length and items \x80\x9e

| Indefinite list \x9f terminated by \xff entry.

}}

| {{ubli

| Length (in pairs) and items \xa0\xbe

| Indefinite map \xbf terminated by \xff key.

}}

style="vertical-align:top;"

| 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}}{{Cite web |title=Efficient Extensible Interchange |url=https://www.w3.org/XML/EXI/index.html}} {{ndash}} which is a "Schema Informed" (as opposed to schema-required, or schema-less) binary compression standard for XML.}}

(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.

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: \x01

| False: \x00

}}

(1 byte)

| Little-endian 2's complement signed and unsigned 8/16/32/64 bits

| {{ubli

| Floats: little-endian binary32

| 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[http://amzn.github.io/ion-docs/docs/binary.html Ion Binary Encoding]

| \x0f{{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: \x11

| False: \x10

}}

| {{ubli

| Positive \x2x, negative \x3x

| Zero is always encoded in tag byte.

| BigInts over 13 bytes (104 bits) have 1+ byte overhead for length

}}

| {{ubli

| \x44 (32-bit float)

| \x48 (64-bit float)

| Zero is always encoded in tag byte.

}}

| {{ubli

| UTF-8: \x8x

| Other strings: \x9x

| Arbitrary length and overhead

}}

| \xbx Arbitrary length and overhead. Length in octets.

| {{ubli

| Structs (numbered fields): \xdx

| Annotations (named fields): \xex

}}

style="vertical-align:top;"

| MessagePack

| \xc0

| {{ubli

| True: \xc3

| False: \xc2

}}

| {{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{{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}}

| {{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;"

| Netstrings{{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 + ','

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
(binary format)

|

|

|

|

|

|

|

style="vertical-align:top;"

| Protocol Buffers

|

|

| {{ubli

| Variable encoding length signed 32-bit: varint encoding of "ZigZag"-encoded value (n << 1) XOR (n >> 31)

| Variable encoding length signed 64-bit: varint encoding of "ZigZag"-encoded (n << 1) XOR (n >> 63)

| 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

| Floats: little-endian binary32

| 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

| \x21

| {{ubli

| True: \x23

| False: \x22

}}

| {{ubli

| Single byte "small" (values {{nowrap|−16 – 15}} encoded as {{nowrap|\xc0\xdf}}),

| zigzag-encoded varints (1–11 data bytes), or BigInteger

}}

| IEEE single/double, BigDecimal

| 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;"

| 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

|

|

|

|

|

|

|

{{notelist|group=binary}}

See also

References

{{reflist}}