---
title: "Test an NDJSON Parser with a Stable Sample File | Mochavi Payloads"
description: "Use small newline-delimited JSON fixtures to test line readers, stream transforms and import pipelines with predictable records."
canonical: "https://payloads.mochavi.com/guides/ndjson-parser-testing"
markdown_mirror: "https://payloads.mochavi.com/guides/ndjson-parser-testing.md"
language: "en"
generated_from: "Payloads source content"
---

> Canonical HTML: [https://payloads.mochavi.com/guides/ndjson-parser-testing](https://payloads.mochavi.com/guides/ndjson-parser-testing)
>
> This machine-readable Markdown page mirrors the canonical Payloads documentation.

# Test an NDJSON Parser with a Stable Sample File

A repeatable way to exercise NDJSON parsing without generating input during the test.

## Short answer

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.

**Parse the users fixture**

```js
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.

## Related fixtures

- [Users NDJSON](https://payloads.mochavi.com/v1/users.ndjson)
- [Projects NDJSON](https://payloads.mochavi.com/v1/projects.ndjson)
- [Tasks NDJSON](https://payloads.mochavi.com/v1/tasks.ndjson)
- [NDJSON format guide](https://payloads.mochavi.com/formats/ndjson)
