Get a field from JSON using FEEL and assign to Variable on Camunda Modeler

Hi All,

I’m using Camuder Modeler-1.1.3, Zeebe-1.1.3
I got an issue when I try to get a field from a json by using FEEL then assign output variable.
I have 2 json are created from micro-service.
response json

{
	"id": "12345",
	"processing": {
		"exceptions":[
		{"error_1":" "file invalid"},
		{"error_2":" "format invalid"}
		],
		"data": {
			"filename" = "abc",
			"filetype" = "jpg"
		}
	}	
}

payload json

{
	"exceptions":[],
	"data":{}
}

my logic is if “exceptions” of response json is null, I will put “data” of response json into “data” of payload json, else I will put “exceptions” of response json into “exceptions” of payload json

this is expression to query data:

= if(response.processing.exception=null) then  
   put(payload, "data", response.processing.data) 
else  
   return put(payload, "exceptions", response.processing.exceptions) 

please help, thank you for any response

Hi @Jay_Tran, you forgot to say what is not working as expected (“expected behaviour” is there, but “actual behaviour” is not).

If you are finding that it always takes the else branch, it may be because an empty array is not equal to null. It is an array with a length of zero.

Josh