Serialize
Synopsis
A data transformation processor that converts structured data into serialized formats including JSON, XML, CSV, TSV, and custom delimited formats, enabling data export and format standardization across different systems.
Schema
- serialize:
type: <enum>
fields: <string[]>
source_field: <ident>
target_field: <ident>
delimiter: <string>
description: <text>
if: <script>
ignore_failure: <boolean>
ignore_missing: <boolean>
include_header: <boolean>
quote_char: <string>
escape_char: <string>
root_element: <string>
xml_namespace: <string>
xml_template: <string>
xml_attribute: <string>
omit_xml_declaration: <boolean>
use_root_as_element: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
tag: <string>
Configuration
The following fields are used to define the processor:
Field | Required | Default | Description |
---|---|---|---|
type | Y | - | Serialization format: json , xml , csv , tsv , or delimited |
fields | N | all fields | Fields to serialize (supports wildcards and exclusions) |
source_field | N | top-level | Source field containing data to serialize |
target_field | N | _raw | Field to store the serialized output |
delimiter | N | , | Delimiter for custom delimited format |
include_header | N | false | Include header row for CSV/TSV/delimited |
quote_char | N | " | Quote character for CSV/delimited formats |
escape_char | N | - | Escape character for CSV/delimited formats |
root_element | N | root | Root element name for XML output |
xml_namespace | N | - | XML namespace URI |
xml_template | N | - | XML element template name |
xml_attribute | N | - | XML attribute name for templated output |
omit_xml_declaration | N | false | Omit XML declaration header |
use_root_as_element | N | false | Use single key as root element |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue if serialization fails |
ignore_missing | N | false | Continue if source field doesn't exist |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
Details
The processor supports multiple serialization formats with format-specific configuration options. Field selection allows precise control over which data elements are included in the serialized output.
Field selection supports wildcard patterns (*) and exclusions (!fieldname) for flexible data filtering.
JSON serialization provides compact, standards-compliant output suitable for APIs and data interchange. XML serialization offers extensive customization including namespaces, templates, and attribute-based formatting for enterprise integration scenarios.
CSV and TSV formats support header generation and custom delimiters for data analysis and reporting workflows. The delimited format provides maximum flexibility with configurable separators, quotes, and escape characters.
Large datasets may impact performance - consider filtering fields to optimize serialization speed.
Examples
JSON Serialization
Converting structured data to JSON... |
|
produces JSON string: |
|
XML Serialization
Converting data to XML format... |
|
creates structured XML: |
|
CSV with Header
Exporting data as CSV with header... |
|
generates CSV format: |
|
Field Selection
Serializing specific fields only... |
|
excludes sensitive information: |
|
XML with Attributes
Creating XML with attribute-based format... |
|
produces Windows Event-style XML: |
|
Custom Delimited Format
Creating pipe-delimited output... |
|
creates pipe-separated values: |
|