# JSONL validate

`jsonl-validate` · version 1.0.0 · JSON & JSONL · free, no key needed

Validate strict JSON Lines text and report the value count and UTF-8 byte length.

**Use when you need to: jsonl validate · validate json lines · check jsonl document.**

## Supported

- jsonl validate
- validate json lines
- check jsonl document

## Not supported

- JSONL comments
- concatenated JSON without newlines
- NDJSON with blank lines
- JSON schema validation
- return valid false
- read files

## Behavior

- text is strict JSON Lines split on CRLF, CR, or LF.
- A trailing empty segment after a final newline is ignored; internal empty lines are rejected.
- A document that is empty or only a trailing newline has zero JSON values.
- At most 5000 lines are accepted.
- Each line is parsed with JSON.parse and must be a JSON-safe value: object, array, string, boolean, null, or safe integer.
- Non-finite numbers, non-integers, and integers outside Number.MAX_SAFE_INTEGER are rejected.
- On success the output is valid true, the JSON value count, and the UTF-8 byte length of text.
- Invalid JSONL throws; the tool never returns valid false.

## Input

- `text` (string, required): max length 256000

## Output

- `valid` (constant true, required)
- `lines` (integer, required): min 0; max 5000
- `bytes` (integer, required): min 0; max 256000

## Limits

- max input bytes: 256000
- max lines: 5000

## Example

Request input:

```json
{
  "text": "{\"name\":\"Ada\",\"ok\":true}\n\"שלום\"\n0\nnull\n"
}
```

Response:

```json
{
  "result": {
    "valid": true,
    "lines": 4,
    "bytes": 43
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "jsonl-validate",
  "version": "1.0.0",
  "input": {
    "text": "{\"name\":\"Ada\",\"ok\":true}\n\"שלום\"\n0\nnull\n"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/jsonl-validate/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"text":"{\"name\":\"Ada\",\"ok\":true}\n\"שלום\"\n0\nnull\n"}'
```

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

### CLI

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

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

## Related tools

- [Array to JSONL](/tools/array-to-jsonl): Serialize an array of JSON-safe values as JSON Lines text.
- [JSON schema validate](/tools/json-schema-validate): Validate a JSON instance against ComputeFirst Schema 1.0.
- [JSONL to array](/tools/jsonl-to-array): Parse strict JSON Lines text into an array of JSON-safe values.
- [JSON array anti join](/tools/json-array-anti-join): Anti join two JSON arrays of objects on exact keys.
- [JSON array concat](/tools/json-array-concat): Concatenate multiple JSON arrays of objects into one.
- [JSON array count](/tools/json-array-count): Count structural occurrences in a JSON array in first-seen order.
