Skip to main content

One post tagged with "Convert Json to DataTable"

View All Tags

· 3 min read
Cansel Kahraman

Managing data formats effectively within your workflow is a common challenge. Often, you might find yourself with data stored in the JSON object format, yet requiring it to be transformed into a more structured data table format. This is where the transformative power of the 'JSON to Data Table' node from our 'Data Table' package comes into play.

In this blog post, we'll delve into how the 'JSON to Data Table' node can be your solution to effortlessly bridge the gap between JSON and data table data within your automation processes.

How to Setup?

To begin, Log in to your Robomotion workspace. If you haven't registered yet, you can create your workspace from the provided link. Once you have access to your workspace, you can proceed by using Data Table package to convert JSON to Data table.

About the Data Table Package

DataTable Package is designed to empower automation developers to handle data transformations with ease. It consists of various nodes that cater to different data manipulation tasks, and one such important node is the JSON to Table node. This node acts as a bridge between JSON data and DataTable, allowing for efficient conversion and manipulation.

Building Blocks for Successful Flow

  • To use the 'JSON To Data Table' node, it's necessary to download the 'Data Table' package.
  • To acquire the 'Data Table' package, navigate to the 'Packages' menu and proceed with the download.

Menu of Packages

Packages download page

About 'JSON to Data Table' Node Inputs

  • The name of the 'JSON' data object must be entered into the JSON Data Box.
  • The output of the 'JSON To Data Table' node is the resulting DataTable object.

Details of ‘JSON to Data Table’ Node Inputs

Flow Steps

  1. ‘Inject’ node is used to initialize the flow.

  2. Use the 'Function' node to create the JSON object.

Code-Block

msg.data = [{
'productID': "123456",
'productSize': "S",
'productColor': "Green",
'productPrice': 25.50,
'productProperties': "Viscon"
},
{
'productID': "123457",
'productSize': "M",
'productColor': "Blue",
'productPrice': 30.00,
'productProperties': "Cotton"
},
{
'productID': "123458",
'productSize': "M",
'productColor': "Red",
'productPrice': 50.00,
'productProperties': "Cotton"
}
]
return msg;

  1. The 'JSON to Data Table' node is employed to transform a JSON object into a DataTable object.

  2. Stop the flow by using the 'Stop' node

JSON to Data Table Flow

Here you can access the complete flow by clicking on the following link: https://casestudies.robomotion.io/designer/shared/Wdsvbt9Wy6wopnK5p7ZbcF