Doing effective null check in MVEL expression for a non existent field

132 Views Asked by At

I have the below json input

{
"fieldA": "fieldNameABC",
"fieldB": "REVERSE"}

I am trying to do a null check on a non-existent field fieldC and if it's present, will map the value as below -

if(input.fieldC!=null) {
  output = input.fieldC; }

Its throwing [Error: could not access: fieldC. Is it possible to check for a field existence in MVEL. If yes, how can this statement be corrected. Have tried empty syntax but same issue.

0

There are 0 best solutions below