# `NPM.JSON`
[🔗](https://github.com/elixir-volt/npm_ex/blob/v0.7.4/lib/npm/json.ex#L1)

JSON helpers for npm manifest and lock files.

`npm_ex` writes generated JSON files such as `package.json`, `npm.lock`, and
shrinkwrap files. Those files should be stable across repeated writes, so maps
are recursively converted to `Jason.OrderedObject` values sorted by key before
encoding. Jason handles the actual JSON encoding, escaping, duplicate-key
checks, and pretty formatting.

# `decode`

```elixir
@spec decode(iodata()) :: {:ok, term()} | {:error, Jason.DecodeError.t()}
```

Decode JSON into maps with string keys.

# `decode!`

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

Decode JSON into maps with string keys, raising on invalid input.

# `encode_pretty`

```elixir
@spec encode_pretty(term()) :: String.t()
```

Encode a term as pretty-printed JSON with recursively sorted object keys.

# `read_file`

```elixir
@spec read_file(String.t()) :: {:ok, term()} | {:error, term()}
```

Read and decode a JSON file.

---

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