Different pipes. One standard.

Type to search this site.

Search runs in your browser against a static index built with this site (Pagefind). Nothing you type is sent to a server.

TransformExperimental

std:json-parse #

Parses NDJSON text into items.

For example: read NDJSON text as records.

A pipe is a data processing step with declared inputs and outputs; standard pipes are built into the runner.

Ports #

std:json-parse takes in and produces out.std:json-parseintextoutrecords
std:json-parse takes in and produces out.std:json-parseintextoutrecords
Named ports from the latest published contract. Dashed lines are optional ports.
Ports of std:json-parse
PortDirectionKindRequiredDescription
ininputtextyes
outoutputrecordsyes

Parameters #

This pipe has no parameters.

When to use it #

  • A pipe or an input gives you text that contains one JSON value per line: turn it into records for the pipes that follow.
  • Fail early on a broken file: a blank line or a line that is not JSON stops the run with E_FORMAT.

When to use something else

A tested example #

Nothing here is invented: this is the test “parses lines and preserves literals” from the pipe's own portable test file, which every conformant runner must pass.

Parameters

This test sets no parameters.

Input: in
{"n":1.50}
"two"
3
Expected output: out
{"n":1.50}
"two"
3

The same step as a node of a pipeline.yaml:

pipeline.yaml
nodes:
  json-parse:
    pipe: std:json-parse
    inputs:
      in: {from: inputs.in}

This input is not plain records. A standalone pipeline.yaml cannot declare the kind of its inputs, so this node belongs in a pipe whose manifest declares the input in with kind text, or after a node that produces that kind.

Run it #

The pipe runs on its own from a shell. The input is the test input above. The quickstart shows how to get the openflange command.

Command
printf '{"n":1.50}\n"two"\n3' | openflange run std:json-parse
Standard output (out)
{"n":1.50}
"two"
3

Executed with openflange 0.0.1 (go1.27.1 linux/amd64), built from commit 11cf8cc of the reference implementation; the output shown is what it printed, and it matches the test.

Notes from the manifest #

The pipe's manifest, OPENFLANGE.md, carries these notes.

Part of the OpenFlange standard library (std, version 0.1).

The explicit conversion from a text stream to JSON items. The text is NDJSON: one JSON value per \n-terminated line. Lines may span text chunks; a missing final newline is tolerated. Each value is kept as its original bytes, so number literals are preserved.

Blank lines, invalid JSON, invalid UTF-8, a byte order mark, or a line longer than 64 MiB fail the run with E_FORMAT (naming the line). Inverse of std:json-format.

Reference #

Maturity
Experimental
Processing scope
record
Manifest version
0.1.0