All Projects → jfacorro → Eden

jfacorro / Eden

Licence: other
edn (extensible data notation) encoder/decoder for Elixir

Programming Languages

elixir
2628 projects
Makefile
30231 projects

Projects that are alternatives of or similar to Eden

Nippy
High-performance serialization library for Clojure
Stars: ✭ 838 (+2518.75%)
Mutual labels:  serialization, edn
Edn Data
EDN parser and generator that works with plain JS data, with support for TS and node streams
Stars: ✭ 44 (+37.5%)
Mutual labels:  serialization, edn
Edn format
EDN reader and writer implementation in Python, using PLY (lex, yacc)
Stars: ✭ 92 (+187.5%)
Mutual labels:  serialization, edn
json to cpp
Generate C++ class from JSON data
Stars: ✭ 42 (+31.25%)
Mutual labels:  serialization
iris
Lightweight Component Model and Messaging Framework based on ØMQ
Stars: ✭ 50 (+56.25%)
Mutual labels:  serialization
serialization-parcelable
Android Parcelable support for the Kotlinx Serialization library.
Stars: ✭ 53 (+65.63%)
Mutual labels:  serialization
yserial
NoSQL y_serial Python module – warehouse compressed objects with SQLite
Stars: ✭ 17 (-46.87%)
Mutual labels:  serialization
Unicorn
A Sitecore utility designed to simplify deployment of Sitecore items across environments automatically
Stars: ✭ 252 (+687.5%)
Mutual labels:  serialization
marshmallow-validators
Use 3rd-party validators (e.g. from WTForms and colander) with marshmallow
Stars: ✭ 24 (-25%)
Mutual labels:  serialization
avro-serde-php
Avro Serialisation/Deserialisation (SerDe) library for PHP 7.3+ & 8.0 with a Symfony Serializer integration
Stars: ✭ 43 (+34.38%)
Mutual labels:  serialization
pony-capnp
Cap’n Proto plugin for generating serializable Pony classes. 🐴 - 🎩'n 🅿️
Stars: ✭ 19 (-40.62%)
Mutual labels:  serialization
dubbo-hessian-lite
Hessian Lite for Apache Dubbo
Stars: ✭ 45 (+40.63%)
Mutual labels:  serialization
Bytes
Swift Library for working with sequences of Bytes (aka [UInt8])
Stars: ✭ 35 (+9.38%)
Mutual labels:  serialization
roswasm suite
Libraries for compiling C++ ROS nodes to Webassembly using Emscripten
Stars: ✭ 62 (+93.75%)
Mutual labels:  serialization
gradle-flatbuffers-plugin
Gradle plugin for generating code from Google FlatBuffers schemas
Stars: ✭ 20 (-37.5%)
Mutual labels:  serialization
Cereal
A C++11 library for serialization
Stars: ✭ 2,986 (+9231.25%)
Mutual labels:  serialization
zkar
ZKar is a Java serialization protocol analysis tool implement in Go.
Stars: ✭ 435 (+1259.38%)
Mutual labels:  serialization
serdepp
c++ serialize and deserialize adaptor library like rust serde.rs
Stars: ✭ 70 (+118.75%)
Mutual labels:  serialization
SafeParcel
Helper library and format description for SafeParcel, a version-agnostic parcelable serializer
Stars: ✭ 29 (-9.37%)
Mutual labels:  serialization
ZFFramework
cross-platform C++ application framework, do 80% work at 20% cost
Stars: ✭ 65 (+103.13%)
Mutual labels:  serialization

Eden

GitHub Hex.pm Hexdocs.pm Hex.pm Hex.pm GitHub

edn (extensible data notation) encoder/decoder implemented in Elixir.

Usage

Include Eden as a dependency in your Elixir project by adding it in your deps list:

def deps do
  [{:eden, "~> 0.1.2"}]
end

Eden is a library application and as such doesn't specify an application callback module. Even so, if you would like to build a release that includes Eden, you need to add it as an application dependency in your mix.exs:

  def application do
    [applications: [:eden]]
  end

Examples

iex> Eden.encode([1, 2])
{:ok, "(1, 2)"}

iex> Eden.encode(%{a: 1, b: 2, c: 3})
{:ok, "{:a 1, :b 2, :c 3}"}

iex> Eden.encode({:a, 1})
{:error, Protocol.UndefinedError}

iex> Eden.decode("{:a 1 :b 2}")
{:ok, %{a: 1, b: 2}}

iex> Eden.decode("(hello :world \\!)")
{:ok, [%Eden.Symbol{name: "hello"}, :world, %Eden.Character{char: "!"}]

iex> Eden.decode("[1 2 3 4]")
{:ok, #Array<[1, 2, 3, 4], fixed=false, default=nil>}

iex> Eden.decode("nil true false")
{:ok, [nil, true, false]}

iex> Eden.decode("nil true false .")
{:error, Eden.Exception.UnexpectedInputError}

Data Structures Mapping: edn <-> Elixir

Edn Elixir
nil :nil = nil
true :true = true
false :false = false
string String
character Eden.Character
symbol Eden.Symbol
keyword Atom
integer Integer
float Float
list List
vector Array
map Map
set MapSet
#inst Timex.DateTime
#uuid Eden.UUID

Further Considerations

Character

There is no way of distinguishing a common integer from the representation of a character in a String or in Char lists. This forces the creation of a new representation for this type so it can be correctly translated from and to edn.

Arbitrary Precision Integer and Float

The Erlang VM (EVM) only provides arbitrary precision integers so all integers will be of this type this and the N modifier will be ignored when parsing an edn integer.

On the other hand native arbitrary precision floating point numbers are not provided by the EVM so all values of type float will be represented according to what the EVM supports.

Keyword and Symbol Representation

On one hand the decision to translate edn keywords as Elixir atoms comes from the fact these two data types are given a similar usage on both languages. On the other, it might get awkward really fast using a new Eden.Symbol struct as the representation for edn's symbols so this might change.

vector

There is no constant lookup or nearly constant indexed data structure like edn's vector other than the :array data structure implemented in one of Erlang's standard library modules. Until there is a better implementation for this Eden will use Array, an Elixir wrapper library for Erlang's array.

edn grammar

expr -> literal | map | list | vector | tagged_value

literal -> nil | true | false | keyword | symbol | integer | float | string

map -> { pair* }
pair -> expr expr

list -> ( expr* )

vector -> [ expr* ]

tagged_value -> tag expr
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].