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 withjson.loads()
.
-
class
txf.layouts.jsonl.
DictReader
(iterable, fieldnames=None, **config)¶ An
iterator
that returns strings parsed withjson.loads()
. It is a subclass oftxf.formats.DictReader
and reads thefieldnames
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 thefieldnames
as keys.
-