# Jmespath expression validate

`jmespath-expression-validate` · version 1.0.0 · Other utilities · free, no key needed

Parse a JMESPath expression and return whether it is valid, plus the zero-based error position and reason.

**Use when you need to: validate a JMESPath expression · parse an AWS CLI query without running it · find a JMESPath syntax error position.**

## Decide before calling

Read the [versioned contract](/v1/tools/jmespath-expression-validate/versions/1.0.0) and the supported scope below. Reuse `jmespath-expression-validate@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `jmespath-expression-validate@1.0.0` for validate a JMESPath expression. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- validate a JMESPath expression
- parse an AWS CLI query without running it
- find a JMESPath syntax error position
- check JSON query expression syntax
- lint a JMESPath filter expression
- verify a JSON projection query
- diagnose an Ansible json_query expression

## Not supported

- evaluate an expression against JSON
- validate JSONPath or jq syntax

## Behavior

- Parses the complete JMESPath 1.0 expression grammar without evaluating data.
- Invalid expressions return valid false with a zero-based UTF-16 error position and bounded parser reason.
- Validation is synchronous and deterministic with bounded expression bytes and tokens.
- Unterminated raw strings and JSON literals are lexer errors positioned at their opening delimiter.

## Input

- `expression` (string, required): max length 256

## Output

- `valid` (boolean, required)
- `error_position` (number or null, required): min 0; max 256
- `reason` (string or null, required): max length 240
- `standard_version` (constant "JMESPath Specification 1.0", required)

## Limits

- max expression length: 256
- max tokens: 256
- max input bytes: 256
- max output bytes: 512

## Example

Request input:

```json
{
  "expression": "foo.bar[0]"
}
```

Response:

```json
{
  "result": {
    "valid": true,
    "error_position": null,
    "reason": null,
    "standard_version": "JMESPath Specification 1.0"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "jmespath-expression-validate",
  "version": "1.0.0",
  "input": {
    "expression": "foo.bar[0]"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/jmespath-expression-validate/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"expression":"foo.bar[0]"}'
```

The machine-readable contract is at [/v1/tools/jmespath-expression-validate/versions/1.0.0](/v1/tools/jmespath-expression-validate/versions/1.0.0).

### CLI

```sh
node cli.mjs run jmespath-expression-validate 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Jmespath search](/tools/jmespath-search): Evaluate a JMESPath expression against JSON and return the projected, filtered, or reshaped JSON result.
- [Cron expression validate](/tools/cron-expression-validate): Check whether a five-field cron expression is supported and return a validity flag with a reason code.
- [Base64url validate](/tools/base64url-validate): Check canonical base64url syntax and return validity plus the first invalid character when present.
- [Cron describe fields](/tools/cron-describe-fields): Parse a five-field cron expression and return each field’s expanded numeric values and wildcard status.
- [Html to plain text](/tools/html-to-plain-text): Strip HTML and script/style text, decode supported references; collapse whitespace including inside pre elements.
- [Polygon measures compute](/tools/polygon-measures-compute): Compute exact signed double-area, area, orientation, and squared edge lengths for a rational simple polygon.
