JSONL Stream Validator
Pricing
Pay per usage
JSONL Stream Validator
Validate a stream of JSONL/NDJSON records against a JSON Schema (draft-07 subset) one line at a time. Per-record error rows, drop-or-tag policy, summary by error type. Pairs with json-schema-validator + jsonl-to-csv.
Pricing
Pay per usage
Rating
0.0
(0)
Developer
Nikita S
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
7 days ago
Last modified
Categories
Share
Validate a stream of JSONL/NDJSON records against a JSON Schema (draft-07 subset) one line at a time. Per-record error rows, drop-or-tag policy, summary by error code.
Pure JS, zero deps (the schema validator is a self-contained subset implementation, not a heavy npm dep). No HTTP calls unless you point jsonlUrl / schemaUrl at a public endpoint. Pairs with:
jsonl-to-csv(Batch 5) — convert validated JSONL to typed CSVjson-schema-validator(Batch 3) — validates the schema itself against meta-rules (use as a pre-check)
Why this Actor
The Apify Store has at least 5 JSON Schema validators, but every one of them:
- takes the data as a single nested array (not a stream), which blows memory on big files;
- lacks a draft-07 subset that's actually usable for ETL pipelines (most implement only
typeandrequired); - doesn't emit per-record error rows tagged with the original line number;
- doesn't let you drop invalid records or keep them tagged, depending on the use case.
This Actor takes JSONL line-by-line, validates each line, and emits one dataset row per record. 1M-line inputs are realistic.
Supported schema features (draft-07 subset)
type— string or array of typesrequired— array of property namesproperties— per-property schemasadditionalProperties—falseor a schemaitems— single schema for array elementsenum,constminimum,maximum,exclusiveMinimum,exclusiveMaximumminLength,maxLength,patternminItems,maxItems,uniqueItemsminProperties,maxProperties
Not in the subset: $ref, oneOf/anyOf/allOf/not, definitions, conditional if/then/else, format. If you need those, normalize the schema first or use json-schema-validator (Batch 3) as a meta-check.
Input
| field | type | required | default | description |
|---|---|---|---|---|
jsonlInline | string | one of two | "" | Raw JSONL/NDJSON text. |
jsonlUrl | string | one of two | "" | Public URL that returns JSONL/NDJSON. |
schemaInline | string | one of two | "" | JSON Schema (draft-07 subset). |
schemaUrl | string | one of two | "" | Public URL that returns a JSON Schema document. |
dropInvalid | bool | no | false | If true, invalid records are dropped (replaced with {_kind:"dropped"}). |
maxErrors | int | no | 100 | Cap error list per record. |
skipEmptyLines | bool | no | true | Skip empty / whitespace-only lines. |
Output
Per input line (one dataset item):
{ "_kind": "valid", "lineNumber": 1, "record": { "id": 1, "name": "Alice" } }{ "_kind": "invalid", "lineNumber": 2, "valid": false, "record": {...}, "errorCount": 1, "errors": [{"path":"/id","code":"type","message":"expected type integer, got string"}] }{ "_kind": "parse_error", "lineNumber": 3, "error": "...", "raw": "{...}" }
Plus a SUMMARY key:
{"totalLines": 5,"parsed": 4,"parseErrors": 0,"schemaValid": 2,"schemaInvalid": 2,"skippedEmpty": 1,"byErrorCode": { "type": 2 }}
Quick start
{"jsonlInline": "{\"id\":1,\"name\":\"Alice\"}\n{\"id\":\"two\",\"name\":\"Bob\"}\n","schemaInline": "{\"type\":\"object\",\"required\":[\"id\",\"name\"],\"properties\":{\"id\":{\"type\":\"integer\"},\"name\":{\"type\":\"string\"}}}"}
Pricing
Pay per event. Each line processed counts as 1 event (regardless of valid/invalid).
Local development
npm installnpm testapify validate-schemaapify run --input-file=./example.json
License
MIT