Machete.JSONMatcher (Machete v0.3.11)
View SourceDefines a matcher that matches JSON documents
Summary
Functions
Matches against JSON documents whose deserialization matches a provided matcher
Types
Functions
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