Skip to content

How do I create a JSON object from the contents of a data file

This example demonstrates creating a JSON Object from the contents of a data file. 

In the solution shown below, a JSON object is created from the data file by converting the attributes of the data file into "Keys" and the contents of the data file into "Values" using "jsonCreateObjectFromDataFile" command. The JSON object is stored into a variable.

Note: The notation to reuse the value of the variable in Worksoft SaaS is ${<Variable Name>}.

Solution:

# Command Target Value
Creating a JSON object from a data file
1 jsonCreateObjectFromDataFile Insurance Details(W) Insurance_Details_JSON

Tips, Tricks, Gotchas & Best Practices:  

  • As a best practice, it is always advisable to define the variable names without any spaces and if you want to differentiate the words, use underscores.
  • You can also optionally pass the data filter name along with data file name using the separator "||" in the "Target" field.


Feedback and Knowledge Base