Skip to main content
All CollectionsBuild AutomationsOperators
Data Transformation Operator: Navigate Data Seamlessly
Data Transformation Operator: Navigate Data Seamlessly

Use the Data Transformation operator to automatically navigate hefty JSON inputs and create consistent executions.

Updated this week

Data interoperability is critical for building complex, reliable, and accessible workflows. Processing large amounts of data can be overwhelming, especially for less technical users. Torq's Data Transformation Operator is here to aid you in taking any input and turning it into an easily navigated output without requiring advanced knowledge. Torq's Data Transformation operator supports any JSON transformation using JQ, including:

  • Mapping & Extraction

  • Renaming keys

  • Converting data types

  • Filtering & sorting

  • If/else conditions

  • Math functions

  • and more!

All of these actions can be completed with natural language and without having to write a single line of code - the operator will generate transformations based on JQ codes for you. If you are familiar with JQ and would like to write your JQ code or edit the ones generated by the operator, this is also possible.

How Does it Work?

The Data Transformation operator uses AI to create the JQ commands as instructed and then applies those JQ codes to the inputted data.

Using the Data Transformation Operator

  1. Drag the transformation operator onto the canvas.

  2. Pass the input through the context and click Transform.

  3. In the transformation window that pops up, enter your prompt in natural language.

    1. When creating the prompt, click on key:value pairs in the input to reference them within the prompt (and the subsequent instructions/code).

  4. Click the generate icon and review the output JSON.

  5. If you feel confident in JQ and want to edit the generated command, click the Code heading.

  6. If you want to create more instructions, enter another prompt and follow the same steps.

  7. Once your output is satisfactory, click Save.

    1. Important: If you do not click Save before navigating away from the transformation window, your prompt and generated commands will not be saved.

Keep in Mind

  • The operator will understand small typos in a prompt, but please try to write with as much clarity as possible.

  • Ctrl+Z undoes the last generated instruction

  • Once saved, you can edit the instructions by clicking the step and then Define Transformation - the transformation window will pop up again.

  • The raw output cannot be edited from within the transformation window.

  • The Data Transformation operator can be used as an alternative for existing Utility steps, such as Extract IP addresses, Extract URLs, Solve equation, Replace substring in text, and more.

  • The more specific your instruction, the more accurate and relevant the code generated.

  • As with Torq's other responsible AI products, no data inputted into the Data Transformation Operator will be used for training.

Example Prompts

Prompt

Action

JQ Command (Likely) Generated

extract vulnerabilities

Extraction

.vulnerabilities

remove descriptions, weaknesses, configurations, references and cvssData

Mapping

map(del(.cve.descriptions, .cve.weaknesses, .cve.configurations, .cve.references, .cve.metrics.cvssMetricV2[].cvssData))

map cvssMetricV2 fields as fields under the cve parent object and delete metrics

Mapping and Deletion

[.[] | .cve += (.cve.metrics.cvssMetricV2[0] // {}) | del(.cve.metrics)]

if baseSeverity equal "HIGH" then change to "10" else if equal "MEDIUM" then change to "6" else if equal "LOW" then change to "3”

Conditional If/Else

[.[] | if .baseSeverity == "HIGH" then .baseSeverity = "10" elif .baseSeverity == "MEDIUM" then .baseSeverity = "6" elif .baseSeverity == "LOW" then .baseSeverity = "3" else . end]

convert baseSeverity to number

Convert Data Type

.[] | .cve.baseSeverity |= tonumber

add averageScore equal to the average of baseSeverity, exploitabilityScore and impactScore

Math

.[] | .averageScore = ((.baseSeverity + .exploitabilityScore + .impactScore) / 3)

sort by averageScore

Sort

sort_by(.averageScore)

Filter averageScore smaller than 8

Filter

.[] | select(.averageScore < 8)

Did this answer your question?