Giter Club home page Giter Club logo

serialization-formats's Introduction

Data serialization formats

Comparison of selected data serialization formats.

Whitespace

x JSON EDN CLJ
whitespace character U+0009 (tab) U+000A (newline) U+000D (return) and U+0020 (space) ⚠️ specs does not specify whitespace chars, explicitly mentions just , ⚠️ specs does not specify whitespace chars, explicitly mentions just ,
delimiters whitespaces, all structural ({ } : , [ ]) and literal (true false null) tokens whitespaces and [ ] { } ( ) ( ⚠️ additional delimiters not mentioned in specs " \ ;) [ ] { } ( ) " \ ; @ ^ ` ~ (:warning: no explicit mention in specs)

Null

x JSON EDN CLJ
null literal null nil nil

Booleans

x JSON EDN CLJ
true literal true true true
false literal false false false

Characters

x JSON EDN CLJ
syntax NONE ❌ \X \X
special characters n/a \newline \tab \return \space \newline \tab \return \space \backspace \formfeed
unicode escapes n/a \uNNNN \uNNNN
octal escapes n/a NO ❌ \o0 to \o377

Strings

x JSON EDN CLJ
syntax wrapped in " wrapped in " wrapped in "
may span multiple lines NO ❌ YES YES
characters which must be escaped " \ and control characters (U+0000 to U+001F) " \ " \
escape characters \" \\ \/ \b \f \n \r \t \" \\ \n \r \t \" \\ \' \b \f \n \r \t
unicode escapes \uNNNN NO, not mentioned in specs ❌ \uNNNN
octal escapes NO ❌ NO ❌ \0 to \377

Integers

x JSON EDN CLJ
arbitrary precision indicator NO ❌ N suffix N suffix
valid signs - - + - +
-0 is valid YES YES YES
decimal integer YES YES YES
custom radix NO ❌ NO ❌ NNrNNNNN
hexa integer NO ❌ NO ❌ 0xNNNNN, but undocumented ⚠️
octal integer NO ❌ NO ❌ 0NNN, but undocumented ⚠️

Non-integral numbers

x JSON EDN CLJ
ratios NO ❌ NO ❌ NN/NN
decimals NO ❌ M suffix M suffix
floats YES YES YES
valid signs - - + - +

Identifiers

x JSON EDN CLJ
symbols NO ❌ YES YES
symbol start character n/a alphabetic, + - . followed by non-numeric symbol character, * ! _ ? $ % & = < > (/ is special, see below) alphabetic, + - * ! _ ? (/ and . are special, see below), ( ⚠️ specs does not mention $ = < > % &)
symbol character n/a alphanumeric, + - . * ! _ ? $ % & = < > : # alphanumeric, + - * ! _ ? (. / and : are special, see below), ( ⚠️ specs does not mention $ = < > % & # ')
special symbol character n/a /, used alone or in following combinations foo/bar (:warning: In my opinion specs does not allow foo// combination, see this ticket). First character after slash must follow rule for symbol start character /, used alone or in following combinations foo/bar foo// (:warning: latter combination is undocumented). ., used as prefix or suffix is reserved to Clojure, used inside symbol divides namespace or package names. : can be used inside symbol, used as suffix is reserved to Clojure (currently it produces an error). (:warning: undocumented restrictions: symbol can not contain ::, namespace part can not end with :, first character after slash must follow rule for symbol start character)
keyword NO ❌ prefixed with : prefixed with :
keyword character n/a alphanumeric, + - . * ! _ ? $ % & = < > : # alphanumeric, + - * ! _ ? (. / and : are special, see below), ( ⚠️ specs does not mention $ = < > % & # ')
keyword invalid second character n/a : none special
special keyword character n/a /, used in following combinations :foo// :foo/bar. First character after slash must follow rule for symbol start character /, used in following combinations :foo/bar :foo// (:warning: latter combination is undocumented). : used as second character resolves keyword in the current namespace, used as suffix is reserved to Clojure (currently it produces an error). (:warning: undocumented restrictions: keyword can not contain :: other than as a prefix, namespace part can not end with :, first character after slash must follow rule for symbol start character) Specs also say that keywords cannot contain '.' ( ⚠️ restriction meant probably only for the name part of the keyword) or name classes.

Collections

x JSON EDN CLJ
list NO ❌ (a b c) (a b c)
vector [a, b, c] [a b c] [a b c]
set NO ❌ #{a b c} items are unique #{a b c} items are unique
map {string1 : val1, string2 : val2] {key1 val1 key2 val2} keys are unique {key1 val1 key2 val2} keys are unique

Special

x JSON EDN CLJ
comments NO ❌ ; till the end of the line ; till the end of the line
discard NO ❌ #_ discards next read object #_ discards next read object
tagged literal NO ❌ # followed immediately by a symbol starting with an alphabetic character # followed immediately by a symbol starting with an alphabetic character
builtin tags n/a #inst #uuid #inst #uuid, deftypes, defrecords and java classes constructors
regular expressions NO ❌ NO ❌ #"pattern"
macros NO ❌ NO ❌ ' (quote), @ (deref), ^ (metadata), #' (var quote), #(% %n %&) (anonymous function), ` (syntax quote), ~ (unquote), ~@ (unquote splicing). (:warning: undocumented macros #= #! #< and deprecated #^)

serialization-formats's People

Contributors

wagjo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.