Using Airtable API to Populate a UIPath Datatable

I am trying to get data from an Airtable base into a UIPath datatable, for use in web form filling. So far, I can successfully connect to the Airtable Rest API using the HTTP Request activity in UI Path, and I can export the JSON output from Airtable into a txt file. But I’m having trouble getting the JSON data into a UIPath data table, which will ultimately be used for web form filling. I have tried all sorts of packages from the marketplace, but I’ve reached my limit as a newbie in json etc… I’m not sure if the Airtable JSON formatting is incompatible with UIPath, or if I have to deserialize the JSON output first, or what… If you have successfully used the Airtable API to populate a UIPath datatable, then I would really appreciate a walk-through!

Hi @jon4378

when you are Deserialize JSON from Airtable, in properties of Deserialize JSON activity select System.Data.DataTable for TypeArgument. This will give output as datatable

image

Hope this is helpful

Thank you Aditya. I will try that. The issue is that I cannot get the deserialization process to work. It is giving me compiler errors. Below is the JSON that I received from my airtable sample base, which I have pasted into the deserialize activity. UIPath is giving me this error: “Main.xaml: Compiler error(s) encountered processing expression [Airtable JSON Here]”

Any ideas would be appreciated!


{“records”:[{“id”:“rec6lccBhE1fZggyg”,“createdTime”:“2022-04-24T02:09:38.000Z”,“fields”:{“Name”:“Jon”}},{“id”:“rec9HPjTYBeST2uis”,“createdTime”:“2022-04-24T02:09:38.000Z”,“fields”:{“Name”:“Mary”}},{“id”:“recQyqIQtV1KirXql”,“createdTime”:“2022-04-24T02:09:38.000Z”,“fields”:{“Name”:“Bill”}},{“id”:“recndPyTDSVmqGE7v”,“createdTime”:“2022-04-24T02:10:09.000Z”,“fields”:{“Name”:“Susan”}}]}

1 Like

Hey @jon4378

  1. Read the text file and store the raw json into a variable

  2. De-serialize JSON with type argument JObject store the output as object

  3. De-serialize JSON again with type argument Datatable. The input you pass to this activity input is jObj(“records”).ToString

jObj is the output of step 2

Now save the 3rd step output into a datatable variable.

Hope this helps.

Thanks
#nK

Hi @jon4378

JSON you shared is not in a usual format so UiPath might be throwing an error. You need to identify where the format issue is and add this correction as a part of your bot if all the JSONs from airtable are same and then Deserialize

adding on to the above if you noticed the double quotes at each of the tags they are smart quotes you need to replace them with straight quotes.

this one possible reason for the issue.

Hello All,
I create here a multiple use cases video for converting JSON to DATATABLE
Thanks,
Cristian