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
iteratorthat returns strings parsed withjson.loads().
- class txf.layouts.jsonl.DictReader(iterable, fieldnames=None, **config)¶
An
iteratorthat returns strings parsed withjson.loads(). It is a subclass oftxf.formats.DictReaderand reads thefieldnamesfrom 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
valuesas a JSON record using thefieldnamesas keys.