Search in a Json with two criteria

Hi
I need help searching in a json file where two criteria must be met before proceeding

I need it to proceed when only Device_code and box_number is the same, as it is now it proceed when only the box_number is meth and it dosen 't care about the device_code.
Hope someone can help me.

msg.xml = msg.payload.DeviceExport.DeviceDetails.find((el => el.DeviceInfo[0].$.device_code === devicecode) && (el => el.DeviceInfo[0].$.box_number === bn))

Without seeing data I can only guess...

msg.xml = msg.payload.DeviceExport.DeviceDetails.find(el => el.DeviceInfo[0].$.device_code === devicecode && el.DeviceInfo[0].$.box_number === bn)

Thanks, it looks like it did the job :slight_smile:

Do you know if it is possible to setup an error message if the criteria is not meth?

You could test if msg.mxl == null then call node.error("not found", msg);