parser

csv

The component converts a JavaScript object (or array) representation to a CSV-formatted string and vice versa. In pair with file or file in components, it allows to store data in a file or read it and use it as a payload.

Here first it converts the string to the object, then objects to CSV-formatted strings.

Properties

Columns (1) - when converting a CSV to an object the component will use this ordered list as keys and payload as values (also it can use the first row for this - see (5)). When converting an object to a SCV these values are used to identify the order of values by keys (see the example above).

Select a Separator (2), give a Name (3) to the component on the workspace (standard property).

CSV to Object options/Input

  • Skip a number of lines (4)

  • choose to use the first row as column names (5)

  • check to return string numerical values as numbers (6)

  • include empty strings (7) - when not checked, you are at risk to get a column shift

  • include null values (8)

The component can accept a group of messages with parts property (see the split and join components to learn more). In this case, use only a comma separator (2).

CSV to Object options/Output

Output (9) - the component can return a message per row or return a single message object as an array.

Object to SCV options

Output (10) - define how to get column names. By default, they will never be sent.

Newline (11) - choose the new line method.

html

The component parses HTML payload and extracts elements in a wanted form.

In this instance, it parsed through <p> tags and returned only text content (without HTML).

Properties

  • Choose an msg Property (1) to take the HTML from.

  • Choose an HTML Selector (2) to extract.

  • The component can return output as the HTML content, text content, and object of attributes (3).

  • Select a single message or multiple messages to output (4).

  • Define the msg property for the output (5).

json

The json parser component converts JSON string to JavaScript object and vice versa.

JSON (JavaScript Object Notation) is a file format that used to transmit data objects key: value pairs between systems. So, an app works with JavaScript objects but receives external data sends data in JSON.

You may recall data types with the Basics chapter.

The json component makes exactly what JSON.parse() and JSON.stringify() JS functions do, so you could use them with a function component instead.

In this example, we first use a string notion of an object, and the json component converts it to a JS object. Then the same notion we use as JSON and J: expression types input. Don't be confused but JSON type input was actually considered as an object, not a string.

Properties

By default, the component examines an input and converting it respectively - as a JSON string or as an object (1). But you can specify and make it convert only strings to objects or objects to strings.

You can choose an msg Property which value will be converted (2).

When converting to JSON string the component can format the output (3) - see the example above.

xml

The component works pretty much as other parsers but with XML data format (see components above).

In the following example, we'll take a simple XML-formatted string and convert it to an object with an xml component. Then yet another xml component will convert it back to the XML string.

Properties

You can specify the msg Property to parse its value. Also, you can change default property names when converting to objects.

yaml

The component converts YAML strings to JavaScript objects and vice versa. The only property you can change is the msg Property which value will be converted. The component work similarly to other parsers (see above).

Last updated