# JSONParser
<span class="source-link">[[Source]](src/json/json_parser.md#L-0-1)</span>

High-level JSON parser. Returns a structured result rather than raising.

```pony
match JSONParser.parse(source)
| let json: JSONValue => // use json
| let err: JSONParseError => env.err.print(err.string())
end
```

Built on top of `JSONTokenParser`: the token parser handles all parsing
logic, and a `JSONReassembler` assembles the tokens into the result.
`parse()` applies no resource limits — it is for a whole document already
in memory, which is trusted to be as large as it is. For input of unknown
origin, or that arrives in pieces, use `JSONTokenParser` directly with a
`JSONParseLimits`.


```pony
primitive val JSONParser
```

## Constructors

### create
<span class="source-link">[[Source]](src/json/json_parser.md#L-0-1)</span>


```pony
new val create()
: JSONParser val^
```

#### Returns

* [JSONParser](json-JSONParser.md) val^

---

## Public Functions

### parse
<span class="source-link">[[Source]](src/json/json_parser.md#L-0-20)</span>


Parse a complete JSON document from a string.


```pony
fun box parse(
  source: String val)
: (JSONValue | JSONParseError val)
```
#### Parameters

*   source: [String](builtin-String.md) val

#### Returns

* ([JSONValue](json-JSONValue.md) | [JSONParseError](json-JSONParseError.md) val)

---

### eq
<span class="source-link">[[Source]](src/json/json_parser.md#L-0-20)</span>


```pony
fun box eq(
  that: JSONParser val)
: Bool val
```
#### Parameters

*   that: [JSONParser](json-JSONParser.md) val

#### Returns

* [Bool](builtin-Bool.md) val

---

### ne
<span class="source-link">[[Source]](src/json/json_parser.md#L-0-20)</span>


```pony
fun box ne(
  that: JSONParser val)
: Bool val
```
#### Parameters

*   that: [JSONParser](json-JSONParser.md) val

#### Returns

* [Bool](builtin-Bool.md) val

---

