Forum Discussion

PaulPeterson1's avatar
PaulPeterson1
Qrew Assistant Captain
3 years ago

How do I get the first element in an array?

I am working on a pipeline that is importing a JSON object into a table.  Some of the elements are being sent as an array even though there is only 1 element in the array.  The Jinja for the fields is something like {{b.item}}.  I have tried {{b.item.selected}} and {{b.item.selectedvalue}} (the latter is the way the item is defined in the JSON generated from the source) without success.  I also tried {{b.item.[1]}} and {{b.item.(1)}}, both of these turn the textbox border red indicating an error.  What are your suggestions?

------------------------------
Paul Peterson
------------------------------
  • PaulPeterson1's avatar
    PaulPeterson1
    Qrew Assistant Captain
    Solved!

    The array was coming back as"[u'Value']"

    I used {{b.item | replace('[u\'','') | replace('\']','')}} to resolve the issue.

    ------------------------------
    Paul Peterson
    ------------------------------