Generate complex arrays from JSON with Ruby

Recipe ToolsData ParserDeveloper Tool

What it does

When a scheduled time arrives, this automation parses a JSON document and executes Ruby code to restructure primitive arrays into complex nested structures. The transformed data is logged to the job report for verification.

Who it's for

Engineering teams who need to convert and restructure array data on a recurring schedule.

How teams use this

Flatten nested JSON into a simple array

Run the scheduled automation to take a complex nested JSON structure and collapse it into a flat primitive array. The job report shows what was transformed.

Restructure data for a downstream system

Modify the Ruby code to add custom logic that reshapes the array into the exact format a connected system expects. The schedule and logging remain unchanged.

Run the transformation on demand

Replace the clock trigger with a webhook so someone can start the array transformation whenever needed instead of on a fixed schedule.

How it works

  1. Run on a specified interval. This automation starts at the scheduled time someone configured, like every hour or daily at 9 AM.
  2. Parse the JSON document. Json Parser extracts and validates the JSON data so it is ready for the Ruby code to process and restructure the array.
  3. Collapse the array with Ruby. Workato Custom Code runs Ruby to transform the primitive array into a complex nested structure that matches the required format.
  4. Log the result to the report. Write the transformed data to the job report so someone can confirm the array was restructured correctly.