flat_file_renderers.json module
- class flat_file_renderers.json.JsonRenderer(context: dict[str, any])[source]
Bases:
BaseRendererRenders data as JSON Lines (a.k.a. NDJSON): one compact JSON object per line.
The same layout used by the OpenSearch/Elasticsearch bulk API. Consumers can read the file line by line instead of loading it whole, and the renderer itself writes record by record without materializing the dataset as a list.
- render(context: dict[str, any], *args, **kwargs) Path[source]
Renders the data as JSON Lines and writes it into a temporary zip file on disk.
Lists and QuerySet-like iterables produce one line per record. Any other dataset (a single record, or a dict with a “rows” key) produces a single line.
- Returns:
Path to the compressed (zip) file containing the .jsonl file(s).
- Return type:
Path