# `TraceGuard.Exporter.JSON`
[🔗](https://github.com/HataluliRandima/trace_guard/blob/v0.1.0/lib/trace_guard/exporter/json.ex#L1)

Encodes diagnostic reports as JSON using `Jason`.

Reports produced by `TraceGuard.TraceBuilder` contain only strings,
numbers, booleans, nil, lists and string-keyed maps, and are redacted
before they reach the exporter. Encoding therefore never needs custom
`Jason.Encoder` implementations.

# `encode`

```elixir
@spec encode(map(), keyword()) :: {:ok, String.t()} | {:error, Exception.t()}
```

Encodes a report.

## Options

  * `:pretty` - pretty-print the output (default `false`)

# `write`

```elixir
@spec write(map(), Path.t(), keyword()) :: :ok | {:error, term()}
```

Encodes a report and writes it to `path`.

---

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