isNdjson
Checks whether a value is a string holding valid newline-delimited JSON — one strict JSON
value per line, as NDJSON and JSON Lines (.jsonl) both define it.
It accepts exactly what @helpers4/json’s parseLines accepts with its default options: blank
lines are tolerated (NDJSON allows them; JSON Lines doesn’t), and an empty string is valid — it
holds zero values.
Available since v3.1.3
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | unknown | The value to check |
Returns
Section titled “Returns”value is string — true if value is a string that parseLines from @helpers4/json reads without error
Examples
Section titled “Examples”Check newline-delimited JSON
Section titled “Check newline-delimited JSON”One strict JSON value per line.
A value cannot span lines
Section titled “A value cannot span lines”Pretty-printed JSON is not NDJSON.
