A small, dependency-free JSON encoder/decoder.
monzo deliberately vendors its own minimal JSON codec rather than
depending on Jason (or any other library) so that it never forces a
version choice on a host application. It supports every JSON construct
needed to talk to the Monzo API: objects, arrays, strings (with unicode
escapes), numbers, booleans, and null.
This is not meant to be a general-purpose, maximally-optimised JSON
library - if your application already depends on Jason, feel free to
swap it in via a custom Monzo.HTTP.Adapter if you need different
performance characteristics. For typical API payload sizes, this codec
is more than fast enough.
Summary
Functions
Decodes a JSON string into Elixir terms. Objects become maps with string keys, arrays become lists, and numbers become integers or floats as appropriate.
Encodes an Elixir term to a JSON string.
Types
Functions
Decodes a JSON string into Elixir terms. Objects become maps with string keys, arrays become lists, and numbers become integers or floats as appropriate.
Encodes an Elixir term to a JSON string.
Maps, keyword lists (of primitives), lists, strings, numbers, atoms
(true/false/nil), and any struct implementing Monzo.JSON.Encoder
(or a plain map after Map.from_struct/1) are supported.