Addon Output Appearing as Object

Options
Hi! I am trying to use an Addon to add a new field to the Parent Object, but instead, it's showing up as a new Object in the output:[Screen Shot 2021-08-16 at 2.56.46 PM.png]
My front end isn't able to step into the Object to get the listenerLiveURL variable, so I want the output to include this variable in the Top-level response, but I'm not quite sure how to get this to work.

I think one issue is I'm using the Airtable Import to populate the field where I'm adding on. The Airtable Import automatically sets the relationship as an Object Array, even though it could just as well be a direct table reference. Are there steps I could take to remove the Object from the Array?

Here's my current set up:
[Screen Shot 2021-08-16 at 2.58.30 PM.png][Screen Shot 2021-08-16 at 2.58.42 PM.png]

Comments

  • Marianna Kerppola
    Options
    For the time being, this is what I came up with, but it's not particularly elegant:
    [Screen Shot 2021-08-16 at 3.16.59 PM.png]
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Are you able to do a return type of a single item for this addon? that would solve the issue
  • David Richardson
    Options
     I'm not sure this is in the right topic heading here but my API generates a list (array of objects).  There are two fields in the list produced  that are table references and I'm using add-ons to get the data.  The first (_nonprofits) presents as an object.  All good.  I can use dot notation to reference values in my JavaScript:
    var nonprofit_id = my_nonprofit.id;

    The second table reference (_artworks) presents as an array (of one item) containing  an object.[objects & arrays.jpg]I hardcode the array element as [0] then use dot notation:
    var premium_id = my_artworks[0].id;

    That said I did not see a way to affect the output of the latter add-on [array] setting up the add-on or customizing it.  

    It would be nice to control how add-ons are presented in the output payload thus easier to handle coding for the webpage.  I'm sure there IS a way but don't know how to find that method.