JavaScript Object Notation Lines

The jsonl layout uses the json module to read and write records using an interface that looks like csv.

The difference between strict JSON and line-oriented JSON (jsonl) is that line-oriented JSON writes out each records on a separate line.

class txf.layouts.jsonl.LineReader(iterable, **config)

An iterator that returns strings parsed with json.loads().

class txf.layouts.jsonl.DictReader(iterable, fieldnames=None, **config)

An iterator that returns strings parsed with json.loads(). It is a subclass of txf.formats.DictReader and reads the fieldnames from the first record if they have not been supplied.

class txf.layouts.jsonl.LineWriter(outfile, fieldnames, **config)

This is simply an alias for txf.layouts.jsonl.LineWriter.

writerow(values)

Writes the the values as a JSON record using the fieldnames as keys.

class txf.layouts.jsonl.DictWriter(outfile, fieldnames, **config)

A txf.layouts.DictWriter that writes JSON records, one per line.

writeheader()

NOP.

writerow(row)

Writes the row in JSON layout with a newline.

writefooter()

NOP