Read Table from JSON/Text/XML

Use the Read Table from JSON/Text/XML activities to convert source data into a table format that functions similarly to a spreadsheet.

After you have created a table, you can use a For Each loop to iterate over its rows or use the table data as variables in other activities. You can also create an empty table and add data to it with output from other activities.

Note: The following notes apply to all Read Table From X activities:

  • Each of these activities has an option to populate column headers from their source data. We do not recommend using this option because the columns will only be populated at run time. If you choose to populate headers this way, you cannot use the column headers when creating a For Each loop.

    We recommend that you add columns individually in the Columns to Read section of the activity properties.

  • Each of these activities has an option to Persist Table. If you want to make changes to a table later, it must be made persistent. Otherwise, you will only be able to read from the table.

Usage

See the specific properties information for each Read Table From X activity.

Read Table from Text

This activity allows you to create a table from plain, delimited text such as comma-separated values. You can set the type of Delimiter Text under Split Options.

The following is an example of Source Text you could read into a table using this activity:

id,name,username,email
1,Leanne Graham,lgraham,leanne@company.com
2,Ervin Howell,ehowell,ervin@company.com
3,Clementine Bauch,wrongusername,clementine@company.com
4,Patricia Lebsack,plebsack,patricia@company.com
        

Read Table from JSON

This activity allows you to create a table from a list of JSON-formatted objects. To tell the activity which objects to select, you need to provide a JSON Path and Source JSON. You can use a JSONPath Query activity to get the JSON Path. A JSON Path to select all objects in the sample data below would be: “$.”.

                
                    
                        
                        [
                      
    {  
      "id":   1,  
      "name":   "Leanne Graham",  
     "username":   "lgraham",  
      "email":   "leanne@company.com"  
   },  
    {  
     "id":   2,  
    "name":   "Ervin Howell",  
     "username":   "ehowell",  
     "email":   "ervin@company.com"  
    },  
   ...  
]          

Read Table from XML

This activity allows you to create a table from a list of XML-formatted objects. To tell the activity which objects to select, you need to provide an XML Path and Source XML. You can use the XPath Query activity to get the XML Path. An XML path to select all objects in the sample data below would be: /root/row.

                
                    
                                                                                                                   <?xml
                         version=
                        "1.0"
                         encoding=
                        "UTF-8"  ?>  
                          root>  
  <row>  
       <id>1</id>  
   <name>Leanne Graham</name>  
    <username>lgraham</username>  
    <email>leanne@company.com</email>  
 </row>  
  <row>  
    <id>2</id>  
    <name>Ervin Howell</name>  
    <username>ehowell</username>  
    <email>ervin@company.com</email>  
 </row>  
  ...  
</root>           

Creating an Empty Table

You can use the Read Table from JSON activity to create an empty table. When you configure the properties, enter an empty list as the source data:

[]        

Sample Workflows

The following sample workflows are available in our repository’s workflows folder to help you get familiar with this concept. These can be imported using the instructions in Import Git Content or you can click the workflow to view it in GitHub.