Array with strings via API

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!


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.

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.

1 Like

@ROARK THANKYOU! Just got it working.

1 Like

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.