A Brief Guide to Line Items, Arrays, and Strings in Zapier
Contents
Workflow automation platforms like Zapier harness the capabilities of apps by combining them to create large, complex processes that require minimal manual intervention. Data is sent from app to app, often changing forms to deliver your desired output.
It's essential to grasp the concepts of line items, arrays, and strings to effectively manipulate and process data within your workflows. These concepts play a significant role in organizing and working with data at a granular level.
In this guide, we will explore how to work with line items, arrays, and strings in Zapier, learning techniques to extract, modify, and utilize specific data within your automation workflows. Whether you're integrating with spreadsheets, APIs, or other applications, gaining a solid understanding of these concepts will unlock new possibilities for streamlining your processes and maximizing the value of your data.
How Data Formatting Works on Zapier
Data on Zapier is typically formatted using JSON (JavaScript Object Notation), so it follows similar conventions. When an event occurs, relevant data captured and made available to subsequent actions.
The main challenge of working with data in Zapier is making sure all the information you need is effectively captured. Not every app receives data in the same way, so manipulation may be necessary to prepare it for the next step. There’s also the challenge of reliability: you’re building an automation that ideally delivers accurate output despite the originating data being different. Proper data formatting will increase accuracy of your workflows and allow for many other automation opportunities.
To begin understanding these data formatting concepts, let’s define them one by one:
What is a String
A string is a single value enclosed by double quotation marks (”) that can include letters, numbers, symbols, and whitespace. In Zapier, strings are considered one data object and can be sent to subsequent actions. They are often just referred to as “text”.
JSON Example: “fruit”: “apple”
, "fruit": "apple, orange, pineapple, mango"
Zapier Example: fruit: apple
, fruit: apple, orange, pineapple, mango
Bear Tip 🐻: JSON does not process real line breaks, but you can use
\n
to represent a new line in a string. If your destination app processes data in JSON (such as Airtable does), the displayed output will include these line breaks.
What is an Array
An array is a collection of values enclosed in brackets ([]) that can be strings, numbers, booleans, objects, or other arrays. In Zapier, arrays are considered separate key-value pairs that can be sent to subsequent actions.
JSON Example: “fruit”: [”apple”, “orange”, “pineapple”, “mango”]
Zapier Example:
1:
fruit: apple
2:
fruit: orange
3:
fruit: pineapple
4:
fruit: mango
What is a Line Item
A line item is a key-value pair containing specific data points. In Zapier, it refers to an individual unit of data (a key and a value). It often corresponds to a specific record or entry, such as a cell in a spreadsheet. If you're working with an API response that returns multiple records, each record can be treated as a line item that is accessed and processed individually.
JSON Example: “fruit”: [”apple”, “orange”, “pineapple”, “mango”]
Zapier Example:
1:
fruit: apple
inventory: 20
2:
fruit: orange
inventory: 45
3:
fruit: pineapple
inventory: 35
4:
fruit: mango
inventory: 40
Depending on your destination app and the way it processes data, you might have to convert information from line items to strings or vice versa. You can do this using Zapier’s Formatter actions.
How to Turn a Line Item into a String
Line items in Zapier are key-value pairs making up an array. Because not all apps support line items, there are situations where you might have to convert them into text strings. You can do this using the Line-item to Text Formatter tool.
The Line-item to Text tool flattens a nested item. To add this action to an existing zap, click the + icon and choose Formatter by Zapier as the app. Select Utilities as the event.
Proceed to the Action setup section and choose Line-item to text as the Transform type. In the separator field, insert the value that separates the values in your list. This will usually be a comma.
Test the action. You should see the items presented as separate fields.
How to Turn a String into a Line Item
Strings in Zapier are treated as one data object. This might not be an issue if you’re sending a single piece of data through to a single destination where allocation of key-value pairs is unimportant, but the method is difficult and error-prone if you are trying to send structured data to a database. Instead, use Formatter by Zapier to convert them.
There are two ways to turn strings into line items:
Using the Text to Line-item Formatter Tool
The Text to Line-item converts a text string into a line-item array. To add this action to an existing zap, click the + icon and choose Formatter by Zapier as the app. Select Utilities as the event.
Proceed to the Action setup section and choose Text to Line-item as the Transform type. Insert your values in the Input section. Input here should be formatted as comma-separated values.
Test the action. You should see items presented as separate fields, with numbered categories that represent line items.
Using the Line Itemizer Tool
The Line Itemizer organizes lines into a line-item array. To add this action to an existing zap, click the + icon and choose Formatter by Zapier as the app. Select Utilities as the event.
Proceed to the Action setup section and choose Line Itemizer (Create/Append/Prepend) as the Transform type. You can produce more descriptive output with this feature by naming groups and properties, then mapping comma-separated text or single values.
Test the action. You should see items presented as separate fields, with groups and properties aligning with the names you specified.
Manipulating Data on a Granular Level with Zapier
It’s easy to dismiss nocode as a mere trend that isn’t capable of bringing fully fledged apps to life. While there are some limitations to nocode solutions, it’s now easier than ever before to build custom workflows. Developing an understanding of programming concepts remains useful because you can use features like Formatter and Code by Zapier to manipulate data according to your specific needs, opening up possibilities that may not be readily available out-of-the-box.
Whether you're integrating with spreadsheets, APIs, or other applications, acquiring a solid understanding of these concepts will unlock new avenues for streamlining your processes and maximizing the value of your data. By transcending the limitations of nocode tools and harnessing the capabilities of data manipulation, you can tailor your workflows to suit your requirements, enabling a more efficient and customized automation experience.