The Conversion/CSVtoJSON extension fetches a CSV file from a provided file path or URL, parses the CSV content, and returns the data as JSON objects.
This is useful when a journey downloads, uploads, or references CSV test data and you need to convert that tabular content into a structured value that can be reused in later validation steps.
Parameters:
-
filePathrequired, a string containing the CSV file URL or Virtuoso file variable to fetch. The value must be reachable from the browser execution context and must return CSV text; -
separatoroptional, a string containing the delimiter used in the CSV file. If this value is not provided, the extension uses a comma,as the default separator;
Note: The CSV file must be accessible to the running journey. If you use $LAST_DOWNLOADED_FILE, the source guidance recommends navigating to a different domain before running the extension to avoid CORS restrictions.
How to apply this to your journey
Use the extension in a journey by calling Conversion/CSVtoJSON with the execute command. Pass each value to the matching extension input using as inputName.
Note: This extension is asynchronous. It returns data only after axios.get(filePath) completes and done() is called. If the request fails, the step fails through doneError(error).
execute "Conversion/CSVtoJSON" using "https://example.com/test-data.csv" as filePath, "," as separator returning $responseexecute "Conversion/CSVtoJSON" using "$LAST_DOWNLOADED_FILE" as filePath, ";" as separator returning $responseYou can also pass a stored Virtuoso variable for the CSV file location and store the converted JSON output in another variable.
execute "Conversion/CSVtoJSON" using "$csvFilePath" as filePath, "$csvSeparator" as separator returning $csvJsonstore value "https://example.com/test-data.csv" in $csvFilePath
store value "," in $csvSeparator
execute "Conversion/CSVtoJSON" using "$csvFilePath" as filePath, "$csvSeparator" as separator returning $csvJsonExample output when the CSV header row contains name,email and one data row contains Ada,ada@example.com:
[
{
"name": "Ada",
"email": "ada@example.com"
}
]This extension requires the following resources:
https://cdnjs.cloudflare.com/ajax/libs/axios/0.27.2/axios.min.jshttps://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.slim.min.jshttps://cdnjs.cloudflare.com/ajax/libs/jquery-csv/1.0.21/jquery.csv.min.js
The extension should be configured as:
- Run asynchronously: Yes
- Scope: Global
Limitation: This extension depends on axios, jQuery, jquery-csv, the configured CDN resources, and browser access to the CSV file path. The request can fail if the file URL is unavailable, blocked by CORS, blocked by content security policy, restricted by authentication, affected by proxy/network rules, or not returned as readable CSV text. The parser uses $.csv.toObjects(), so it expects a header row that can be used as object keys and converts all parsed values as text; it does not validate schemas, normalize data types, evaluate formulas, or handle spreadsheet-only features. Large CSV files can increase browser memory usage and may make the async step slow or unreliable. Async extension scripts must complete within Virtuoso's documented 120-second maximum execution window, and this source does not define its own shorter timeout or retry logic. Cross-browser note: This extension does not inspect the page DOM, but it does use browser network behavior and third-party browser libraries. Validate it in each browser/device configuration used by your plan because CORS enforcement, network access, downloaded-file URLs, CDN loading, and resource restrictions can differ across Chromium, Firefox, Safari, Edge, iOS, Android, and remote-grid executions.
Add the extension to your Virtuoso instance
Select the domain that matches your Virtuoso account.
View source
Last updated: 04/06/2026
Resources:
https://cdnjs.cloudflare.com/ajax/libs/axios/0.27.2/axios.min.jshttps://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.slim.min.jshttps://cdnjs.cloudflare.com/ajax/libs/jquery-csv/1.0.21/jquery.csv.min.js
// Note this extension is not a product feature of Virtuoso and is not officially supported
// Extensions use javascript which may or may not be compatible with systems under test (SUTs)
// We welcome you to use this extension or adapt it for your needs
// Instructions:
// This extension allows you to convert CSV files to JSON format
// Write a step: CSVToJSON (filepath)
// If the CSV is not comma delineated, than you also need to pass in the separator e.g. CSVToJSON (filepath,";")
// The filepath can either be a cloud location e.g. https://location.com/test.csv
// If you have clicked a link to download the CSV in your test, then it will be stored into $LAST_DOWNLOADED_FILE, so you would write CSVToJSON ($LAST_DOWNLOADED_FILE)
// Note that if using LAST_DOWNLOADED_FILE, you need to add an additional step to switch into a different domain to avoid CORS issues, as follows:
// Navigate to "https://s3-eu-west-1.amazonaws.com/virtuoso-downloaded-files/test.html" in new tab
// CSVToJSON ($LAST_DOWNLOADED_FILE)
// If separator is defined, use it. Defaults to comma
const customSeparator = separator ? separator : ",";
axios.get(filePath).then(result =>
done($.csv.toObjects(result.data, {separator:customSeparator}))
).catch(error => doneError(error));
Comments
0 comments
Please sign in to leave a comment.