Skip to content

Main content

JSON Lines Terminal Newline State Tool

Calculate json lines terminal newline state from explicit caller-supplied inputs.

Loading tool…

Description

Reject carriage returns, split nonempty text on linefeeds, and drop one final terminator entry.

A line-delimited JSON record stream places a complete JSON value on each record line. Terminal newlines and blank-line policies affect record counts independently of value parsing.

Reject carriage returns, split nonempty text on linefeeds, and drop one final terminator entry.

When to use this tool

Use JSON Lines Terminal Newline State when you need the implemented strict line-ending and record-count check.

How to use the tool and how it works

  1. Enter text. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read terminated, empty, records. Inspect terminated, empty before interpreting the associated values.

Reject carriage returns, split nonempty text on linefeeds, and drop one final terminator entry. Require every remaining line nonempty and parse each as JSON; return termination state and record count.1

Input fieldMeaning and unitsAccepted input
textTextRequired. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
terminatedTerminatedRequired. Boolean.
emptyWhether the represented collection or span has no occupied elements.Required. Boolean.
recordsRecordsRequired. Safe integer.
json
{
  "input": {
    "text": "1\n2\n"
  },
  "output": {
    "terminated": true,
    "empty": false,
    "records": 2
  }
}

Limitations and assumptions

  • Empty input has zero records; blank lines and CRLF are rejected, and no streaming or per-record output is provided.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use a streaming parser with an explicit line-format policy for large files and record-specific error reporting.

References

  1. Calculation and input contract: json/json-lines-terminal-newline-state — tool.io

Similar or alternative tools