joetjen.net
EN DE
← All libraries
Elixir

dextrin

The reference implementation of DXN (Data eXchange Notation) for Elixir: .dxn text, .dxnb binary, .dxns schema.

Intention

JSON is human-writable but loses precision; Protobuf is compact and typed but needs a compiler step and no human reads it. DXN’s premise is that a text document and a binary document should be the same value space — 30 types, precise enough for money and exact ratios, with structs and custom tags as first-class extension points.

Example
{:ok, value} = Dextrin.decode(~s(%{x: 1, y: 2}))
#=> {:ok, %{x: 1, y: 2}}

{:ok, bytes} = Dextrin.encode_binary(value)
Dextrin.decode_binary(bytes)
#=> {:ok, %{x: 1, y: 2}}
Install
{:dextrin, "~> 0.1.0"}
ElixirSerializationCBOR