# JsonPathParser
<span class="source-link">[[Source]](src/json/json_path.md#L-0-57)</span>

Parser for JSONPath expressions.

Provides two entry points:
- `parse()` returns errors as data (consistent with `JsonParser.parse()`)
- `compile()` raises on invalid input (convenience for known-valid paths)


```pony
primitive val JsonPathParser
```

## Constructors

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


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

#### Returns

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

---

## Public Functions

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


Parse a JSONPath expression. Returns a compiled query on success
or a structured error on failure.


```pony
fun box parse(
  path: String val)
: (JsonPath val | JsonPathParseError val)
```
#### Parameters

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

#### Returns

* ([JsonPath](json-JsonPath.md) val | [JsonPathParseError](json-JsonPathParseError.md) val)

---

### compile
<span class="source-link">[[Source]](src/json/json_path.md#L-0-79)</span>


Parse a JSONPath expression, raising on invalid input.

Use this when the path string is known to be valid (e.g., a string
literal). For user-provided paths, prefer `parse()` which returns
errors as data.


```pony
fun box compile(
  path: String val)
: JsonPath val ?
```
#### Parameters

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

#### Returns

* [JsonPath](json-JsonPath.md) val ?

---

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


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

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

#### Returns

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

---

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


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

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

#### Returns

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

---

