Oct 01, 2021 06:31 AM
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!
Oct 01, 2021 07:39 AM
Hi,
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.
Oct 01, 2021 08:02 AM
@ROARK THANKYOU! Just got it working.