Skip to main content
Question

How do I get the first element in an array?

  • Jun 30, 2022 12:48 PM UTC
  • 0 replies
  • 101 views

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
------------------------------
This topic has been closed for replies.

  • Author
  • Qrew Cadet
  • Jun 30, 2022 2:07 PM UTC
Solved!

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

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

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