1. Docs
  2. Formulas
  3. Functions

OBJECTS_TO_CSV

Parses an array of objects with the same keys into CSV-formatted text. Headers are optional, if none are provided the keys of the first object are used.

Categories: Data Parsing/Conversion

Syntax

OBJECTS_TO_CSV(objects, headers)

Examples

Example 1

Input

1
{
2
"my_action": {
3
"objects": [
4
{
5
"age": 45,
6
"city": "Melbourne",
7
"name": "John Smith"
8
},
9
{
10
"age": 32,
11
"city": "Sydney",
12
"name": "Jane Doe"
13
},
14
{
15
"age": 27,
16
"city": "Brisbane",
17
"name": "Bob Jones"
18
}
19
]
20
}
21
}

Formula

OBJECTS_TO_CSV(my_action.objects)

Output

"name, age, city\nJohn Smith, 45, Melbourne\nJane Doe, 32, Sydney\nBob Jones, 27, Brisbane\n"

Example 2

Input

1
{
2
"my_action": {
3
"objects": [
4
{
5
"age": 45,
6
"city": "Melbourne",
7
"name": "John Smith"
8
},
9
{
10
"age": 32,
11
"city": "Sydney",
12
"name": "Jane Doe",
13
"address": "123 Main St"
14
},
15
{
16
"age": 27,
17
"city": "Brisbane",
18
"name": "Bob Jones"
19
}
20
]
21
}
22
}

Formula

OBJECTS_TO_CSV(my_action.objects, ["name", "age", "address"])

Output

"name, age, address\nJohn Smith, 45,\nJane Doe, 32, 123 Main St\nBob Jones, 27,\n"

Sample actions

Event Transform
My Action
Event Transform
OBJECTS_TO_CSV

Select an action to inspect

You can also click "Copy actions" and paste them in your Tines story to see how they work.

Was this helpful?
OBJECTS_TO_CSV | Docs | Tines