YAML_PARSE
Takes text containing YAML and parses to an object
Categories: Data Parsing/Conversion
Syntax
YAML_PARSE(text, [parse_date_or_time: FALSE], [version: 1])
Examples
Example 1
Input
1
{
2
"my_action": "---\ntimeout: 10\nqueues:\n- one\n- two\n- three\nscheduler:\n max_workers: 10\n"
3
}
Formula
YAML_PARSE(my_action)
Output
1
{
2
"queues": [
3
"one",
4
"two",
5
"three"
6
],
7
"scheduler": {
8
"max_workers": 10
9
},
10
"timeout": 10
11
}
Example 2
Input
1
{
2
"my_action": "\nLinkedDate: 2007-04-01 12:00:00\n"
3
}
Formula
YAML_PARSE(my_action, parse_date_or_time: TRUE)
Output
1
{
2
"LinkedDate": "2007-04-01 12:00:00 UTC"
3
}
Example 3
Input
1
{
2
"my_action": "---\nNestedObject:\n LinkedDate: 2007-04-01 12:00:00\n List:\n - :foo\n - bar\n"
3
}
Formula
YAML_PARSE(my_action, version: 2)
Output
1
{
2
"NestedObject": {
3
"LinkedDate": "2007-04-01 12:00:00 UTC",
4
"List": [
5
"foo",
6
"bar"
7
]
8
}
9
}
Sample actions
Select an action to inspect
You can also click "Copy actions" and paste them in your Tines story to see how they work.