JSON, CSV, XML Format Transformer
The Format Transformer component in DatErica allows for seamless transformation of data between JSON, CSV, and XML formats.
Overview
The Format Transformer component enables:
- Conversion of data from one format to another (JSON, CSV, XML).
- Previewing both the incoming and transformed data structures.
Configuration Steps
-
Open Component Config: Navigate to the Format Transformer component configuration interface. This component must have an incoming edge from a previous component to determine the original data structure and type.
-
Incoming Data Structure and Type: Upon opening the config, the incoming data structure and type (XML, CSV, or JSON) are immediately visible.
-
Select Target Format: Choose the desired target format (JSON, CSV, XML) from the dropdown menu.
-
Test Transform:
- Click the 'Test Transform' button to perform the transformation.
- The data preview will switch to the 'Transformed Data Preview' tab, displaying the transformation result.
-
Advanced Settings:
- Access advanced settings specific to each transformation direction.
- These settings provide additional control over the transformation process.
Detailed Settings
Transform Direction
- Transform Incoming Format: Select the incoming data format (CSV, XML, JSON).
- To: Choose the target format for the transformation (JSON, CSV, XML).
Result Preview
Advanced Settings
Each transformation direction has a unique set of advanced settings to fine-tune the process. Here are some common examples:
Advanced Settings for CSV to JSON Transformation
When transforming CSV to JSON, you can configure the following advanced settings:
- Trim: Removes leading and trailing whitespace from each field. (On by default)
- Skip Empty Lines: Ignores empty lines in the CSV file. (On by default)
- Skip Records With Empty Values: Skips records that contain empty values.
- Relax Quotes: Allows for unquoted quotes inside quoted fields.
- Cast Date: Attempts to convert date strings to actual date objects. (On by default)
- Columns: Maps CSV columns to specific JSON fields. (On by default)
- Group Columns By Name: Groups columns with the same name.
- Bom: Handles the byte order mark in the CSV file.
- Cast: Converts numeric and boolean strings to their respective types. (On by default)
- Skip Records With Error: Ignores records that have parsing errors.
- Found Delimiter: Specifies the delimiter used in the CSV file. (Auto-detected by default)
Advanced Settings for XML to JSON Transformation
When transforming XML to JSON, you can configure the following advanced settings:
- Trim Values: Removes leading and trailing whitespace from each text node. (On by default)
- Always Create Text Node: Ensures that text nodes are always created, even if empty.
- Remove NS Prefix: Removes namespace prefixes from element and attribute names. (On by default)
- Ignore Attributes: Ignores XML attributes during transformation. (On by default)
- Allow Boolean Attributes: Allows XML attributes to be interpreted as boolean values. (On by default)
- Ignore Pi Tags: Ignores processing instruction tags in the XML. (On by default)
- Parse Tag Value: Parses the text content of elements to determine if they should be treated as numbers, booleans, or strings. (On by default)
- Ignore Declaration: Ignores the XML declaration (e.g.,
<?xml version="1.0"?>
). (On by default)