cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

2nd object from json object array

deepak_shaw
Contributor

Question: I have input JSON array

[

{โ€œnameโ€:โ€œAUโ€, โ€œvalueโ€: 3},

{โ€œnameโ€:โ€œUSโ€, โ€œvalueโ€: 1},

]

I want to have 2nd object i.e. {โ€œnameโ€:โ€œUSโ€, โ€œvalueโ€: 1}

please advise how to get it?
Thanks,
DK

2 REPLIES 2

viktor_n
Contributor II

Hi @deepak.shaw,

If they are documents then you can use Gate snap and after gate you just select $input0[1], and it will return you always the second document. But if you want last document than use Tail snap.

Note: Gate snap will wait all documents to come on input and after will return you the data.

deepak_shaw
Contributor

Thanks for the reply.
Actually, Iโ€™m receiving the message from Kafka Consumer like: