Short answer
What to know
Fetch a versioned .ndjson collection, decode it as text, split on line boundaries and parse each non-empty line as JSON. Payloads provides users, projects and tasks as application/x-ndjson with stable bytes.
Use a complete but small NDJSON collection
The sample is intentionally small. It exercises multiple records, Unicode, nullable fields and scalar values without making a failed test difficult to inspect.
const response = await fetch("https://payloads.mochavi.com/v1/users.ndjson");
const text = await response.text();
const records = text
.split(/\r?\n/)
.filter(Boolean)
.map((line) => JSON.parse(line));Test line handling separately from JSON handling
- A final newline must not create a phantom record.
- Blank lines should follow an explicit policy.
- A malformed line should report its line number.
- Chunk boundaries in a real stream do not necessarily align with newline boundaries.
- Each decoded line should be validated independently when partial ingestion is allowed.
Static file versus live stream
The endpoint returns an NDJSON file; it does not drip records over time. It is suitable for parser, importer and response-body tests. To test backpressure, partial chunks or timeouts, place the same fixture behind a controllable local stream.