Convert to JSON

⚠ Experimental Feature

This feature is Experimental and may change based on user feedback and testing. Share your thoughts with our team to help us improve it.

The Convert to JSON (JavaScript Object Notation) block allows users to transform structured data formats, such as CSV, XML, and Excel, into JSON, which is widely used for data exchange and automation processes.

This feature enhances the ability to process and transfer data efficiently between applications.

Note: This feature is available starting from Release 2025.1.

This block allows users to transform Excel, CSV, and XML files to JSON format, making them easier to share, store, and process in automation workflows.

Example: A CSV file containing customer data can be converted to JSON and then sent to another system via an API call.

Fully expanded, the Convert to JSON block shows the following properties:

convert-to-json

The Block Header ("Convert to JSON")

The green input connector in the header is used to trigger the block to start executing.

The green output connector in the header triggers when the file type has been successfully converted to text.

The title of the block “Convert to JSON” can be changed by double-clicking on it and typing in a new title.

File Input

The Convert to JSON block supports multiple file formats as input. The file content can be dynamically provided from other blocks within the automation flow.

Source Type

Once you drag the file into the block, the block will automatically recognize the file type. A user can choose any of the below options as a source type:

  • Data File: File for upload will be saved inside of Leapwork.
  • Local Path: File for upload will be referred to from a specified path.

Select file to convert

This field allows you to drop the file that is to be converted.

Text fields

In the Convert to JSON block, text fields allow the use of external values (dynamic data) when Local Path is selected as the source type.

To insert a field value, right-click the text field below the Local Path label and choose Insert token, then enter the name of the field.

Fields can be renamed by double-clicking on them; any inserted tokens will automatically update their visual representation to match the new name.

Output

This property contains the output result of the block, which will be JSON data once the conversion process is completed.

The blue output connector triggers when the file type has been successfully converted to text and can be used as the source element in other building blocks.

Failed

This green output connector triggers if the file type is not converted within the time specified in the timeout field.

This connector can be used to branch the execution of the flow based on whether the file type is converted or not.

Default Timeout

If the Default Timeout property checkbox is not selected, then the timeout value is 10 seconds. If the Default Timeout property checkbox is selected, then the Default Timeout value selected in the flow settings will be applicable.

Timeout

The maximum time spent converting the file type before giving up and triggering the Not converted connector.

Note: All cases have a global timeout that can be configured in the Settings panel. This is unrelated to the timeout of a single building block. However, a running case will automatically be cancelled if it runs for longer than the global timeout.

Download

To download the resulting TXT file generated by the Convert to JSON block, use the Save file block to save the output locally.

 

Updated 04.07.25