Best answer

JSON data from Airtable is being read as a string. How do I ensure it's read as JSON?

  • 24 March 2022
  • 3 replies
  • 418 views

I have JSON data stored in a long-text field in Airtable that I want Zapier to use as line-item data. The JSON data is an array of objects but Zapier is reading it as a string.

 

I would think that Zapier should be able to recognize the data as JSON in the initial trigger result dataset. However, I’ve also tried using Zapier’s Formatter app to reformat the string, but this doesn’t work either. The Formatter app is apparently designed for the use case of a CSV string input and is unable to gracefully handle the JSON data format. (This makes sense—it’s intended to output JSON data, after all. I don’t really want to use Formatter in my Zap anyway. It’d be inefficient, since the data should already be readable as JSON!)

 

How do I make sure that Zapier reads this field as the JSON dataset that it is, rather than escaping it as a plaintext string?

icon

Best answer by Troy Tessalone 25 March 2022, 00:40

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +14

Hi @aleafa 

Good question.

The reason the JSON data is being interpreted as text is because the Airtable field is a long text field.

Try using a Code step to parse the JSON

 

EXAMPLE

 

RESULTS

 

Thanks @Troy Tessalone! This is very helpful. It solves the issue.

Out of curiosity, would there be a simpler way to achieve the same result by configuring the Airtable field differently or storing the data there in a different format?

Userlevel 7
Badge +14

@aleafa 

I don’t know of a way to store the JSON data in an Airtable field that when that data is sent to the Zap trigger it would be interpreted as JSON.

For example, if the JSON was not structured correctly then it could corrupt the data payload sent to Zapier.

That is most likely why the data in a Long text field comes over as text regardless of how it’s formatted.