Flatten Objects
Snippets are pieces of workflows. You can copy and paste them directly into any Tray workflow.
New to snippets? Watch this video
For more details please see our Snippet Documentation
About this SnippetCopy
This is a snippet with two different tools baked in. You can pick which one works for you and delete the Branch and the other tool you don't need.
Tool 01 - Flatten a Single Object
This snippet ingests a nested object and flattens it by concatenating the keys of the nested object together.
E.g. Turn this object:
1{2person: {3name: "Sarah"4}5}
into this flat object:
1{2person.name: "Sarah"3}
Tool 02 - Flatten an ARRAY of Objects
This is a script snippet that can take an ARRAY of nested objects and flatten them by concatenating the keys of the nested object together.
This is the same effect as the first tool, but you can pass it a list/array of objects and it will flatten ALL of them.