Forum Discussion

ashis1upreti's avatar
ashis1upreti
New Contributor II
2 years ago
Solved

optional field on mapper

Hello team

I am getting error "Cannot invoke a method on a null value, snap" due to optional field being absent. In some JSON the "primary_mkt_ind" field is coming as value "NULL" so I have the below check. But in some JSON that I am consuming, that field is entirely not present.

$.get('primary_mkt_ind').toUpperCase() == 'NULL' ? "" : $.get('primary_mkt_ind')

 Can you pls help me get rid of this situation, where I will be doing this NULL check only when that value is coming as null.

"market_exchange_cd": "SCP",
"market_country_cd": "US",
"primary_mkt_ind": "NULL"

 

Thank you in advance!