Skip to main content
Output Utilities

Explore the output utility steps in Torq.

Updated over 2 months ago

Use these utility steps to transform and present data in various formats. Below are examples of each step's input and output.

Add data to context

Adds the given JSON object or list to the flow's context.

Input

{"addresses": ["google.com", "192.168.1.5"]}

Convert to JSON

Converts the output of a previously executed step to JSON format, using the CLI tool "jc". This step accepts these data types: XML, YAML, CSV, or output of shell commands.


Create ASCII table

Generates an ASCII or Markdown table and populates it with the given input.

Input

[{"name":"foo", "age":"32"},{"name":"bar", "age":"53"}]

Output

 "tabulate_output": "+-----+------+\n| AGE | NAME |\n+-----+------+\n|  32 | foo  |\n+-----+------+\n|  53 | bar  |\n+-----+------+\n"

Create CSV

Creates a CSV file from the given input.

Input

[{"name": "Bob", "age": 54, "email": "bob@company.com"}, {"name": "Alice", "age": 45, "email": "alice@company.com"}]

Output

  "result": "\"age\",\"email\",\"name\"\n54,\"bob@company.com\",\"Bob\"\n45,\"alice@company.com\",\"Alice\"",

Create HTML Table

Create HTML table from given input.

Input

[{"name": "Bob", "age": 54, "email": "bob@company.com"}, {"name": "Alice", "age": 45, "email": "alice@company.com"}]

Output

  "result": "<table class=\"torq-table\">\n<thead><tr>\n<th>age</th>\n<th>email</th>\n<th>name</th>\n</tr> </thead>\n<tr>\n<td>54</td>\n<td>bob@company.com</td>\n<td>Bob</td>\n</tr>\n<tr>\n<td>45</td>\n<td>alice@company.com</td>\n<td>Alice</td>\n</tr>\n</table>",

Create Markdown Table

Generates a Markdown table and populates it with the given input.

Input

[{"name":"foo", "age":"32"},{"name":"bar", "age":"53"}]

Output

  "tabulate_output": "| AGE | NAME |\n|-----|------|\n|  32 | foo  |\n|  53 | bar  |\n"

Data Transformer

Parse given data using various UNIX shell utilities, such as sed, grep, jq, etc.


JSON parser

Parses the given raw data as JSON and outputs it directly to the step context. Supports using output from generic Docker images as steps (e.g., aws-cli). If no input is provided, the parser will use the previous step's output as input.


Print a Message to stdout

Print a message to stdout.


Strip HTML Tags

Strips HTML tags from the given input.

Input

<html>
<head>
<title>My Title</title>
</head>
<body>
<h1>My Heading</h1>
<img src="my_dog.jpg" alt="dogs.com" width="104" height="142">
</body>
</html>

Output

  "result": "\n  \n    \n  \n  \n    My Heading\n    \n  \n",

Did this answer your question?