# `OpenUI.JSON`
[🔗](https://github.com/ideia4it/openui/blob/v0.1.1/lib/openui/json.ex#L1)

JSON on top of Elixir's `JSON` that keeps the key order of objects.

Objects decode to `OpenUI.JSON.Object`. Plain maps still encode, in map
order.

# `decode`

```elixir
@spec decode(binary()) :: {:ok, term()} | {:error, term()}
```

Decodes `binary`, returning objects as `OpenUI.JSON.Object`.

# `decode!`

```elixir
@spec decode!(binary()) :: term()
```

Like `decode/1`, but raises on invalid JSON.

# `encode!`

```elixir
@spec encode!(term(), keyword()) :: String.t()
```

Encodes `term`. With `pretty: true`, indents with two spaces and ends with a
newline.

# `object`

```elixir
@spec object([{String.t(), term()}]) :: OpenUI.JSON.Object.t()
```

Builds an ordered object from key-value pairs.

# `to_plain`

```elixir
@spec to_plain(term()) :: term()
```

Replaces every `OpenUI.JSON.Object` with a plain map, recursively.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
