woob.tools.application.formatters.json

class JsonFormatter[source]

Bases: IFormatter

Formats the whole list as a single JSON list object.

flush()[source]
format_dict(item)[source]

Format a dict to be human-readable.

Parameters:

obj (dict) – dict to format

Return type:

str

format_collection(collection, only)[source]

Format a collection to be human-readable.

Parameters:

collection (BaseCollection) – collection to format

Return type:

str

class JsonLineFormatter(display_keys=True, display_header=True, outfile=None)[source]

Bases: IFormatter

Formats the list as received, with a JSON object per line. The advantage is that it can be streamed.

format_dict(item)[source]

Format a dict to be human-readable.

Parameters:

obj (dict) – dict to format

Return type:

str