Data workflow guides

Round-Trip Mixed Line Endings in a JSONL Archive

·

Keep the original bytes when archiving evidence from an interrupted log capture. Blank lines, broken records and unexpected separators can help explain what a downstream parser saw.

NDJSON JSONL Compressor

Check the four physical lines in the fixture

Load the example and select Compress to GZIP. The summary shows a 58-byte UTF-8 payload with four physical lines. A UTF-8 BOM precedes the first object. The fixture includes one CRLF, one LF and one bare CR. Its final null has no terminal line break.

The source also contains an empty line and a record with a missing value. JSON Lines validation would flag these details. The archive keeps the bytes so you can analyze the capture later.

JSON Lines encoding, terminators and compression conventionsRFC 1952, GZIP member format and integrity fields

Extract the saved archive and compare framing

Download records.jsonl.gz. Use output to extract, or choose Extract and open that saved archive. The extracted file again has 58 bytes and the same framing counts. The report shows the original line break evidence even when a text editor displays the separators similarly.

For your own file, use Open a local text file before compressing. Reopen the extracted records.jsonl as bytes or compare SHA-256 digests. Matching digests confirm that you recovered the same byte sequence, including the final line.

RFC 1952, GZIP member format and integrity fieldsWHATWG Compression Standard, GZIP decompression behavior

Validate a separate copy for a strict consumer

Keep the archive as the original evidence. If a receiver expects JSON Lines, validate a separate restored copy before submitting it. A compliant JSON Lines input uses UTF-8 without a BOM and one valid JSON value per line.

The local extraction path has an 8 MB output limit. When a larger archive needs restoring, use a compatible GZIP reader that can stream the expected payload and verify its integrity.

JSON Lines encoding, terminators and compression conventionsWHATWG Compression Standard, GZIP decompression behavior

Common questions

Can I combine several independent files into this archive?

This workflow writes one GZIP member for one UTF-8 payload. GZIP is separate from a multi-file ZIP or TAR archive.

Will a CRLF record get changed to LF during extraction?

Extraction preserves the stored bytes. For exact input from a text editor or exporter, open the file directly before compressing.

Sources

Put it into practice.

Related guides