Decode and encode JSON without altering the key order.
The package can be installed by adding johnson
to your list of dependencies in mix.exs
:
def deps do
[
{:johnson, "~> 1.0.0"}
]
end
iex(1)> Johnson.decode!(~s({"a":"a","b":"b"}))
%Johnson{data: [{"a", "a"}, {"b", "b"}]}
iex(2)> Johnson.encode!(%Johnson{data: [{"a", "a"}, {"b", "b"}]})
~s({"a":"a","b":"b"})
iex(3)> Johnson.get(%Johnson{data: [{"a", "a"}, {"b", "b"}]}, "a")
"a"
The docs can be found at https://hexdocs.pm/johnson.
This library is released under the MIT License.
See the COPYING file for full license information.