How to take json response of api and manipulate it in a table?

Hi Retool Community,

My issue/challenge is as follows:

  1. I hit an API (get_po) and get a response like this:

{
"odata.metadata":"https://someapi/someversion/$metadata#somedata",
"value":[
{
"ID":4951,
"Number":2110330,
"Date":"2021-08-02",
"Address":"Las Vegas Nevada 281769",
"Reference":"As per mail on 13.09.2020_,",
"Value":41300,
"AddnInf":[<some_data_in_json>]
},
{
"ID":4951,
"Number":2110330,
"Date":"2021-08-02",
"Address":"Las Vegas Nevada 281769",
"Reference":"As per mail on 13.09.2020_,",
"Value":41300,
"AddnInf":[<some_data_in_json>]
} ],
"odata.nextLink":"somdata?$filter%20=%20$skip=20"
}

  1. I publish the data in a table using ( {{get_po.data}} ) but the data is getting stored in columns
    where col 1 contains json of id 4950 and col 2 contains json of id 4951
    *The headers of the columns are 0, 1 and so forth

Challenge:
How can I do the following:

  1. Store data for every json object in a row
  2. Every row has column headers like (id, number date, reference etc.)
  3. How do I use the column which has another json (AddnInfo) and put it in another table with respective column headers and rows.
  4. How to use : "odata.nextLink":"somdata?$filter%20=%20$skip=20" , fetch the next batch of 20 results and add on the desired table until the data set is exhausted

Please let me know if I can provide any further information.

My skill level: Noob in JS , intermediate in sql

Have you tried {{get_po.data.value}} in the Data property of the table? Data wants an object of arrays or an array of objects but it looks like {{get_po.data}} would just return odata.metadata and value

1 Like