Work with Parsers
Parsers are an important part of Hero Platform_. They do not have a dedicated location in the UI and found within Inputs, Lookups and functions.
Example (CSV parser within a File System Input):
The above image is a File System Input form and the yellow box shows the CSV parser section. After selecting the input format (CSV in this example), there are fields for configuring the parser. Different parsers have different configuration fields.
How Parsers are Used in Hero Platform_
Parsers are used for filling the field mapping table with detected data or from a predefined list. With their configuration and the field mappings they generate tuples or tuple field values from input bytes.
Enter the delimiter that separates values in the file.
- comma (,)
- semicolon (;)
- A blank space
- bar (|)
Check the radio button to indicate if headers are present.
If headers are present, check the radio button if the headers should be:
- Upper case
- Lower case
Select the character set for the CSV
Select the field detection strategy:
Detect types - Hero Platform_ automatically detects the data types for each field.
Values of fields that have a Date_Time data type require the following format: yyyy-MM-dd HH:mm:ss
Convert to String - All fields are set to the String data type.
- Enter example text for detecting. (Optional)
If this field is filled, its content is used for the field detection. If the example text for detecting box is left empty, the parser reads from the Input.
Consumes the whole Input (a file or HTTP response body) and converts it to a single binary field.
Consumes the whole Input (a file or HTTP response body) and converts it to a single text field.
Parses email fields. The Input must be a in EML format.
A good choice for parsing saved emails.
Consumes the whole Input (a file or HTTP response body). The Input must be a valid JSON.
Root path (optional) is used to parse only the part of JSON specified by the path. Other parts outside of the path are ignored. For the sample JSON below, users, meta or meta.settings are the valid root paths. Or Root path can be left empty.
Date_Time format is used for detecting and parsing the Date_Time fields in the Input JSON. Learn more about Hero Platform_'s Date_Time formats.
Below is a sample JSON fitting Hero Platform_'s default Date_Time format: yyyy-MM-dd HH:mm:ss
Mark flatten top level array box when the top level element (the root path is respected) in the JSON is an array.
- If the JSON's top level element is in an array and the feature box is marked, Hero Platform_ detects multiple individual tuples.
If the JSON's top level element is in an array and the feature box is not marked, Hero Platform_ could produce a list field with tuples.
In the example below, if the flatten top level array feature is marked, two String fields will be detected (id, name) and three tuples will be parsed. The results will be three separate lines in the field mapping.
If the flatten top level array feature is unmarked, a single field will be detected (LIST<TUPLE>) and only that one tuple will be parsed and list with the three id-name pairs in it.
- Example text for detecting (optional) allows for copying and pasting a sample JSON into the box for field detection. If this field is filled, its content is used for the field detection. If the detecting text box is left empty, the parser reads from the Input (I.e. opens the Input file or does an HTTP request.)
Suitable for converting application log lines to tuples.