Data tools

JSONL processor

Validate a JSON Lines file line by line, or convert it to/from a JSON array. validate never throws on a bad line, naming every one instead; the two convert modes refuse (naming the first bad line) rather than silently dropping or mangling a record. Runs entirely on your device.

Runs on your device. The file is never uploaded.

JSONL processor checks that every line of a .jsonl file parses, and converts between that shape and a single JSON array. validate is the default and never throws, naming every bad line; the two array modes stop at the first one. Blank lines are dropped before parsing, so a reported line number counts non-blank lines rather than file position.

Input

Options

Questions

What do the three modes do?

validate parses every line and reports which ones fail, producing no file. to-json-array turns the lines into one JSON array, written with two space indentation. from-json-array does the reverse, taking a JSON array and writing one compact JSON value per line. validate is the default.

Why does validate list errors but the convert modes stop?

Because they answer different questions. validate is meant to survey a whole file, so it never throws and instead names every bad line with its line number and the parse error. The convert modes refuse at the first bad line, naming it, rather than silently dropping a record or writing a mangled one.

How are blank lines treated?

They are skipped. Lines that are empty or only whitespace are removed before parsing, so a trailing newline or a blank line between records does not count as an invalid line. Line numbers in the report are positions among the non-blank lines, not byte offsets in the file.

What are the output files called?

to-json-array writes your file name with .json on the end, and from-json-array writes it with .jsonl. validate writes nothing at all, since its answer is the report. Each mode also prints a count, for example how many lines became how many array elements.

Why did from-json-array refuse my file?

Either the file is not valid JSON, in which case the parse error is included, or the top level value is not an array. A single JSON object cannot become JSON Lines here, because the tool needs a list of values to write one per line. Wrap it in an array, or use to-json-array if you had it the wrong way round.

Is my data uploaded?

No. The file is decoded and parsed in your browser and the result is built there. Nothing goes to a server. The whole file is held in memory as text and again as parsed values, so a large JSONL file needs several times its size in memory and is limited by your device.

Related Data tools