﻿# JSON text sequences: record separators and recovery after malformed data

Distinguish JSON text sequences from newline-delimited JSON and multiple-value parsers, and preserve evidence when recovery skips a malformed record.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/guide-json-sequences-record-separator-recovery/
Language: en

## A sequence has explicit record framing

JSON text sequences define a format in which each JSON text has a record-separator prefix and a line-feed suffix, using UTF-8. This framing differs from treating every newline as the end of one JSON document.

For an artifact-index or evaluation-result feed, the declared format determines the parser. A pretty-printed JSON value can contain formatting newlines. A receiver should not infer a newline-delimited contract merely because the transport arrives as text or because a sample happens to fit on one line.

## Recovery can preserve later records

The sequence specification permits parsing to continue after an invalid element, with failure reporting left to the application. The record separator offers a resynchronization point that ordinary concatenated values do not automatically provide.

A proposed importer records that recovery occurred. Continuing successfully is different from accepting every source record. If a damaged result is skipped, an evaluation summary must not quietly present the remaining records as the complete population originally emitted by the producer.

## Tool modes choose failure behavior

The jq manual documents a sequence mode that emits the separator framing and warns about malformed input while discarding data until the next separator. Its behavior is a useful concrete illustration of recovery, not a guarantee that every JSON parser makes the same choice.

Preserve the tool mode and diagnostic outcome with an import. Redirecting only parsed output can conceal warnings from a pipeline consumer. A clean output file might therefore contain valid records while lacking some intended input records.

## Multiple-value support is a different capability

The ijson documentation exposes a multiple_values option and notes backend capability differences. Accepting more than one top-level value does not by itself establish support for the sequence format's separator byte or its recovery policy.

Choose a parser matching the actual wire representation. Adding a permissive option to solve a trailing-data error can change which input is accepted without addressing framing or data-loss reporting. Document the adapter if a sequence is transformed before reaching the JSON parser.

## Record identity must survive missing elements

The sequence specification does not supply a reliable positional identity or an end-of-sequence marker. A consumer that needs completeness should use application-level identifiers and an independently defined completion contract.

A proposed review includes formatting newlines, malformed elements, truncated tails and missing records. It asks whether the consumer can distinguish recovered data from a complete accepted artifact, rather than counting the absence of a final parser exception as proof that every emitted model result survived.

## Primary references

[JSON text sequence specification](https://www.rfc-editor.org/rfc/rfc7464.html).

[jq sequence mode](https://jqlang.org/manual/).

[ijson parser options and capabilities](https://github.com/ICRAR/ijson).

Related explanations: [SSE byte boundaries](/journal/provider-sse-utf8-chunk-boundaries/); [Record provenance](/journal/document-markdown-json-provenance/).
