Re: Array with strings via API

165 0
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

Hey! First time here.

Guys, I need the Airtable API to return an array on this format:

But the only way I could make it return was in 2 separated arrays, like this:

Is there anyway to return it like the first image?

Thanks in advance!

2 Replies 2
6 - Interface Innovator
6 - Interface Innovator


you will run into trouble if you try to get these values from two separate fields, as the order will be messed up, if either “slug” or “name” is empty.

One way to go about this is to create a function field in your Categories table and reference that instead.
Screen Shot 2021-10-01 at 16.33.42

Here is the formula:

'[{"category":"' & {Name} & '","slug":"' & {Slug} & '"}]'

In you script you will probably have to use the JSON.parse() method, as it will be interpreted as a string and not an object.

@ROARK THANKYOU! Just got it working.