Torq's Data Transformation Operator is here to revolutionize your usage of JSON. Data interoperability is critical for building complex, reliable, and accessible workflows. Processing large amounts of data can be overwhelming. The Data Transformation Operator will seamlessly turn your input into an easily comprehensible 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
Creating new JSONs
and much 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 commands for you. If you are familiar with JQ and would like to write your own commands or edit the ones generated by the operator, this is also possible.
JQ is a high-performance and robust language for processing JSON structures. The Data Transformation Operator allows non-JQ coders to create complex instructions, and advanced JQ users can use advanced JQ features to create their own instructions.
How Does it Work?
The Data Transformation operator uses AI to create commands as instructed and then applies those commands to the inputted data. This saves you from having to do any calculations or heavy lifting.
The Data Transformation operator can filter the same data set multiple times according to different criteria, remove irrelevant fields from JSON objects, add fields such as counts or other calculations, and more. This can be done from within a single Data Transformation Operator, with no need to parse through multiple steps.
Using the Data Transformation Operator
Drag the transformation operator onto the canvas.
Pass the input through the context and click Transform.
Enter your prompt in natural language in the transformation window that pops up.
When creating the prompt, you can click on
key:value
pairs in the input to reference them within the prompt (and the subsequent instructions/code).
Click the generate icon and review the output JSON.
If you feel confident in JQ, click the Code heading and edit the code.
If you want to create more instructions, enter another prompt and review.
Once your output is satisfactory, click Save.
Important: If you do not click Save before navigating away from the transformation window, your prompt and generated transformation will not be saved.
Keep in Mind
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.
Once saved, you can edit the instructions by clicking the step and then Define Transformation. The transformation window will pop up again.
As with Torq's other responsible AI products, no data inputted into the Data Transformation Operator will be used for training.
The operator will understand small typos in a prompt, but please try to write clearly.
Ctrl+Z undoes the last generated instruction.
The Data Transformation operator accepts input via context. The operator will not work with raw and/or pasted content.
The raw output cannot be edited from within the transformation window.
The Data Transformation operator has an input size limit of 5MB and an output size limit of 5MB.
If you do not see the Data Transformation operator, it may be because your organization opted out of Torq AI features. Please contact Torq support if you have not opted out and still do not see the operator.
Save as a Custom Step
Save your Data Transformation as a custom step to share and reuse throughout your workspace or organization. This will revolutionize data interoperability across your entire organization with no fuss.
Should you generate a Data Transformation that you feel could apply to multiple workflows or instances, save it as a custom step (by accessing the three-dot menu at the top right of the operator) to be accessed in your Step Library > Custom > Data Transformation.
You can then share that custom step to be used as a Data Transformation operator with any of your organization's workspaces.
As with other custom steps, if a user edits your custom Data Transformation step in a different workflow or workspace, it will not affect your original Data Transformation operator.
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) |