Skip to content
← All Tools
๐Ÿ”’All processing in your browser ๐ŸšซNo uploads stored ๐Ÿ›ก๏ธPrivacy-first conversion tools โœ“No login required
Tutorial

How to Use the Ndjson Validator: Step-by-Step Tutorial

Bill Crawford — Developer Tutorial — 2026  ยท  Published April 8, 2026

The Ndjson Validator runs entirely in your browser โ€” your data file is never sent to any server, no account is required, and nothing leaves your machine. This tutorial walks through every step of using the tool: loading an NDJSON or JSONL file, reading each results panel, understanding what the validator checks, and diagnosing the issues it reports.

Connect on LinkedIn โ†’

Follow along with the tool open: Open the Ndjson Validator in a second tab, then work through each step below.

Open Ndjson Validator โ†’

Table of Contents

  1. Step 1 โ€” Open the Tool
  2. Step 2 โ€” Load Your NDJSON File
  3. Step 3 โ€” Click Validate
  4. Step 4 โ€” Read the Status Bar
  5. Step 5 โ€” Review the Error Panel
  6. Step 6 โ€” Review the Warnings Panel
  7. Step 7 โ€” Read the Stats Panel
  8. Step 8 โ€” Inspect the Keys Panel
  9. Step 9 โ€” Review the Data Preview
  10. Worked Examples
  11. Tips and Edge Cases

Step 1 โ€” Open the Tool

Navigate to /developer-tools/ndjson-validator/. The tool loads entirely in the browser โ€” after the initial page load, validating a file makes zero outbound network requests. You can confirm this in your browser's DevTools Network panel: drop a file and watch the network tab remain idle.

The tool is accessible from the Developer Tools hub, the command palette (press Ctrl+K or โŒ˜K and type "NDJSON Validator"), or directly via the URL above.

Step 2 โ€” Load Your NDJSON File

There are two ways to load a file. The easiest is drag and drop: drag your .ndjson, .jsonl, or .json file from your file manager and drop it anywhere on the drop zone. The drop zone accepts these extensions up to 50 MB.

Alternatively, click the "browse" link inside the drop zone to open a file picker dialog. Select your file and the tool loads it immediately โ€” you will see the filename appear in a bar above the buttons.

If you drop a file with an unsupported extension, the tool displays a type error message identifying the extension that was rejected. Only .ndjson, .jsonl, and .json files are accepted. To clear the file and load a different one, click the โœ• button in the filename bar.

Step 3 โ€” Click Validate

After loading your file, click the Validate NDJSON button. Validation runs in JavaScript in your browser tab โ€” for most files under a few megabytes, results appear instantly. Clicking the button also clears any results from a prior run, so you can validate multiple files in sequence without reloading the page. Clicking Clear removes the loaded file and resets the tool to its initial state.

Step 4 โ€” Read the Status Bar

After clicking Validate, a status bar appears below the buttons. It is colour-coded to give you an immediate answer:

Step 5 โ€” Review the Error Panel

If validation fails, a red Validation Errors panel appears below the status bar. Each error is listed with its line number and the parser's error message. The validator reports the first 10 errors by line number; if there are more than 10, a summary count is shown for the remainder. Common error messages and what they mean:

"Line N: JSON syntax error โ€” Unexpected token X in JSON at position P"

The JSON parser could not parse line N. The character X at position P is where the parser gave up. Common causes:

"Line N: root value is a bare [type], not a JSON object or array"

Line N parsed successfully as JSON, but the top-level value is a string, number, boolean, or null rather than an object or array. NDJSON records should be objects {} or arrays []. This error is most commonly caused by an export script that wrote a quoted string or a numeric value to each line instead of a full JSON object.

"File contains null bytes"

The file contains null bytes, which cannot appear in a valid UTF-8 text file. This usually means the file is binary content mistakenly given an NDJSON extension, or it was saved in UTF-16 or UTF-32 encoding rather than UTF-8. Open the file in a hex editor to confirm the encoding, then re-save as UTF-8 text.

"File contains no non-empty lines" / "File is empty"

The file has no content after stripping whitespace and the trailing newline. Verify you loaded the correct file โ€” the filename bar shows the name of the loaded file for confirmation.

Step 6 โ€” Review the Warnings Panel

If warnings were detected, a yellow Warnings panel lists each one. Warnings do not prevent the file from being used โ€” the structure is valid โ€” but they flag conditions that may indicate data quality problems:

"N empty line(s) found at line(s): X, Y, Z"

Blank lines were found in the file. A single trailing blank line is silently removed before processing; only interior empty lines or multiple trailing blank lines are reported. If the empty lines were intentional separators, most NDJSON parsers will handle them correctly, but the NDJSON specification does not require parser support for interior blank lines.

"UTF-8 BOM detected at the start of the file"

The file begins with a UTF-8 byte order mark. The validator strips the BOM and continues processing, but the warning is shown because strict JSON parsers will fail on a BOM-prefixed file. Re-save the file without the BOM: in VS Code, click the encoding indicator in the status bar and choose "Save with Encoding" โ†’ UTF-8 (without BOM).

"File uses bare CR (\\r) line endings"

The file uses old Mac-format line endings. Convert the file to LF line endings before using it in production โ€” most NDJSON tools handle CRLF, but bare CR is not universally supported.

"Key "X" is missing from N of M record(s)"

A top-level key that appears in some records is absent from others. The message tells you the key name, how many records have it, and how many are missing it. Decide whether the missing key is intentional (the field is optional) or a data quality problem (a bug in the export logic). If you expect every record to have this key, investigate the records where it is absent.

"Line N: duplicate key(s) in object: "X""

Record on line N contains the key X more than once. The duplicate key will cause silent data loss in most parsers โ€” only one of the values will survive. Find the line in your source file, identify which value is correct, and remove the duplicate.

"File contains a mix of JSON objects (N) and JSON arrays (M)"

Some records are objects and some are arrays. This is technically permitted by the NDJSON specification but unusual in practice. If the mix is unintentional, check your export logic โ€” you may be concatenating records from two different sources that use different shapes.

Step 7 โ€” Read the Stats Panel

When a file passes validation (green or yellow status), a green "Valid NDJSON" stats panel shows file-level metrics extracted during parsing:

Step 8 โ€” Inspect the Keys Panel

For files where records are JSON objects, a second green panel lists all distinct top-level keys found across all records, sorted alphabetically, with a count in the panel header showing how many unique keys were found. Use this panel to:

Keys are listed with sequential numbers in the left column for easy reference. If a key appears here but you expected it to be absent, or is absent when you expected it to be present, investigate the records that contain (or don't contain) it using the data preview below.

Step 9 โ€” Review the Data Preview

The data preview panel renders the first 5 records in a formatted table โ€” one column per top-level key, one row per record. For object records, column headers show the key names; for array records, headers show index positions ([0], [1], etc.).

Use the preview to visually confirm the parsed data looks correct:

The preview is not a substitute for full data review, but it is the fastest way to catch structural problems โ€” a misconfigured export, a shifted delimiter, or an encoding issue that garbles string values โ€” before the file is loaded into a production system.

Worked Examples

Example 1: ML fine-tuning dataset rejected by the API

Situation: You prepared a JSONL fine-tuning dataset for a language model API. The API rejected the file with a generic "invalid format" error and provided no line number.

What to do: Drop the file into the Ndjson Validator. If the error panel shows "Line 47: JSON syntax error โ€” Unexpected token ' in JSON at position 12", look at line 47 in your file โ€” it almost certainly contains a single-quoted string. JSONL for ML fine-tuning must use standard JSON with double quotes. Find and replace all single-quoted strings in your data before resubmitting. If the error panel shows a root type error ("root value is a bare string"), your export script wrote escaped JSON strings rather than JSON objects โ€” fix the serialization logic to write full objects.

Example 2: Database import produces fewer rows than expected

Situation: You exported 10,000 records from your database as NDJSON and then imported the file into a new database. The import completed but only 9,847 rows appear in the destination table.

What to do: Drop the file into the Ndjson Validator and check the stats panel. If "Total records" shows fewer than 10,000, some records were not written to the file during export โ€” investigate the export script for silent failures. If "Total records" shows 10,000 but "Parse errors" is 153, then 153 records are malformed and were skipped during import โ€” check the error panel for the line numbers and examine those records in the original file to find the export bug.

Example 3: Key consistency warning on a log export

Situation: You exported structured application logs as NDJSON. The validator shows the file is valid but with 3 key consistency warnings. The warning messages say that the key stack_trace is missing from 9,240 of 9,328 records.

What to do: This is expected behavior. The stack_trace key is only present on error-level log records (88 out of 9,328), which is intentional โ€” it is an optional field that only appears when there is an error to report. No fix is needed. Note the warning for your downstream consumers so they know to handle the missing key gracefully (treat absence as null).

Example 4: Validating a streaming API capture

Situation: You recorded the streaming response from an API and saved it as a .ndjson file. You want to confirm the capture is complete and all records parsed correctly before archiving it.

What to do: Drop the file into the Ndjson Validator. Check "Total records" against the expected number of streaming chunks. Check "Parse errors" โ€” it should be zero for a clean capture. Check "BOM present" โ€” some capture tools prepend a BOM on Windows. Check the data preview to confirm the first 5 records contain the expected fields and values. If everything looks correct, the capture is complete and the file is ready to archive.

Tips and Edge Cases

BC
Bill Crawford
Founder, Data Conversion Center

Bill Crawford is a data systems developer and technical founder with over 30 years of professional experience in accounting, finance, and business operations. He founded DataConversionCenter.com to build practical, browser-based tools that simplify complex data challenges.

Professional Background