A json decoder/encoder solely created to test the parser combinator library nimble_parsec :)
json_string = "{\"a\":\"wow\",\"c\":{\"l\":[\"a\",23.2],\"x\":23}}"
{:ok, %{"a" => "wow", "c" => %{"l" => ["a", 23.2], "x" => 23}}} =
NimbleJson.decode(json_string)
m = %{
a: "wow",
c: %{l: ["a", 23.2], x: 23}
}
{:ok, "{\"a\":\"wow\",\"c\":{\"l\":[\"a\",23.2],\"x\":23}}"} = NimbleJson.encode(m)
If available in Hex, the package can be installed
by adding nimble_json
to your list of dependencies in mix.exs
:
def deps do
[
{:nimble_json, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/nimble_json.