Forum Discussion

manohar's avatar
manohar
Contributor
3 years ago

Ignore the null in array

hi there, I have to map an array object as in the screenshot below.

I have 2 records in that array. one is coming in as null and the other has value as in the below screenshot. how can I ignore the one that’s null and map the one with value? as it looks like its taking the second record, that’s null

Thanks
Manohar

1 Reply

  • Supratim's avatar
    Supratim
    Contributor III

    Hi @manohar ,
    Try this option-
    $response.entity[‘order-header’][‘order-lines’].filter((val,index)=> val != null)