JsonFileWriter#

class JsonFileWriter(file: IO[str])[source]#

Bases: FileWriter[str]

Write records as one JSON array.

Each write reads the whole file and rewrites it. Content that is not valid JSON is erased.

Wrap the file and write an empty array if the file is empty.

Raises:

ValueError – If the stream is not writable or is not a text stream.

Attributes

Methods

write

Append data to the JSON array.

mode: str = 'a+'#
write(
data: Measurement | Command,
) → None[source]#

Append data to the JSON array.

newline: str | None = None#