export_to_json
Serialize parsed FatturaPA invoice data into clean, indented JSON format. Control indentation and choose whether to include empty fields.
Instructions
Serialize a parsed FatturaPA dict to a clean, indented JSON string.
Call this after parse_fattura_xml() when you need a human-readable or machine-transferable representation of the invoice. By default, null/empty fields are omitted (include_empty=False) to reduce noise in the output.
indent controls JSON indentation (0 = compact, 2 = standard readable, 4 = wide). include_empty=True retains all keys even when their value is null or empty string.
Always succeeds. Returns {'json_string': str, 'size_chars': int}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parsed_fattura | Yes | Parsed FatturaPA dict as returned by parse_fattura_xml(). Will be serialised to a clean, indented JSON string. | |
| indent | No | JSON indentation level (0–8 spaces). Default 2. | |
| include_empty | No | Include fields with null/empty values in output. Default False. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||