ukchukx / johnson

Decode and encode JSON without altering the key order

Home Page:https://hex.pm/packages/johnson

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Johnson

hex.pm version License: MIT

Decode and encode JSON without altering the key order.

Installation

The package can be installed by adding johnson to your list of dependencies in mix.exs:

def deps do
  [
    {:johnson, "~> 1.0.0"}
  ]
end

Basic Usage

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"

Documentation

The docs can be found at https://hexdocs.pm/johnson.

License

This library is released under the MIT License.

See the COPYING file for full license information.

About

Decode and encode JSON without altering the key order

https://hex.pm/packages/johnson

License:MIT License


Languages

Language:Elixir 100.0%