# `Machete.JSONMatcher`
[🔗](https://github.com/mtrudel/machete/blob/main/lib/machete/matchers/json_matcher.ex#L1)

Defines a matcher that matches JSON documents

# `t`

```elixir
@opaque t()
```

Describes an instance of this matcher

# `json`

```elixir
@spec json(term()) :: t()
```

Matches against JSON documents whose deserialization matches a provided matcher

Takes a matcher as its sole (mandatory) argument

Examples:

    iex> assert "{}" ~> json(map())
    true

    iex> assert ~s({"a": 1}) ~> json(%{"a" => 1})
    true

    iex> assert "[]" ~> json(list())
    true

    iex> assert "[1,2,3]" ~> json([1,2,3])
    true

    iex> assert ~s("abc") ~> json(string())
    true

    iex> assert "123" ~> json(integer())
    true

    iex> assert "true" ~> json(boolean())
    true

    iex> assert "null" ~> json(nil)
    true

---

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