# `Localize.Utils.Json`
[🔗](https://github.com/elixir-localize/localize/blob/v0.39.0/lib/localize/utils/json.ex#L1)

JSON decoding utilities wrapping the OTP `:json` module.

Provides a `Jason`-compatible `decode!/1,2` interface suitable
for decoding JSON data in Localize. Uses the built-in `:json`
module available in OTP 27+.

# `decode!`

```elixir
@spec decode!(String.t() | charlist()) :: term()
```

Decodes a JSON string into an Elixir term.

JSON `null` values are decoded as `nil`. By default, object keys
are strings. Pass `keys: :atoms` to decode keys as atoms.

### Arguments

* `string` — a JSON-encoded string or charlist.

### Options

* `:keys` — when set to `:atoms`, decodes object keys as atoms.

### Returns

* The decoded Elixir term.

### Examples

    iex> Localize.Utils.Json.decode!(~s({"foo": 1}))
    %{"foo" => 1}

    iex> Localize.Utils.Json.decode!(~s({"foo": 1}), keys: :atoms)
    %{foo: 1}

    iex> Localize.Utils.Json.decode!(~s({"bar": null}))
    %{"bar" => nil}

# `decode!`

```elixir
@spec decode!(
  String.t() | charlist(),
  keyword()
) :: term()
```

---

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