View Source StableJason.Encoder (stable_jason v0.0.1)
Utilities for encoding Elixir values to a deterministic or stable JSON.
Summary
Functions
Generates stable JSON corresponding to input
using %Jason.OrderedObject{}
from Jason
.
Example
iex> StableJason.Encoder.encode(%{c: 3, b: 2, a: 1})
{:ok, %Jason.OrderedObject{values: [{"a", 1}, {"b", 2}, {"c", 3}]}}
iex> StableJason.Encoder.encode(<<0::1>>)
{:error,
%Protocol.UndefinedError{
protocol: Jason.Encoder,
value: <<0::size(1)>>,
description: "cannot encode a bitstring to JSON"
}}