JSONPATH error -> invalid path

I am performing a JSONPATH transformation of an API answer. If the device is offline the json expression containts on error code which i am parsing with and it works

var String Anova_online = transform( "JSONPATH", "$.error.code" , Anova_Answer)

but when the device is online the path with error doesn’t exist and I get an error in the log

13:27:00.337 [ERROR] [core.transform.actions.Transformation] - Error executing the transformation ‘JSONPATH’: Invalid path ‘$.error.code’ in ‘{“status”:{“cooker_id”:“anova f56-a007e005da4”,“is_running”:true,“current_temp”:65.5,“target_temp”:65.5,“temp_unit”:“c”,“speaker_mode”:true,“current_job_id”:“5793c128-95a0-47d6-ae02-d8f524512da5”,“current_job”:{“job_id”:“5793c128-95a0-47d6-ae02-d8f524512da5”,“job_type”:“manual_cook”,“job_stage”:“maintaining”,“is_running”:true,“target_temp”:65.5,“temp_unit”:“c”,“job_start_time”:“2018-03-04T11:21:08.569504Z”,“job_update_time”:“2018-03-04T11:21:09.569505Z”,“max_circulation_interval”:300,“threshold_temp”:4.444444444444444,“job_info”:{“display_item_identifier”:“1520162467787”,“duration”:0,“job_type”:“manual_cook”,“source”:“3”,“temperature”:65.4,“temperature_unit”:“C”}},“is_timer_running”:false}}’

The docu says that the transformation should return null when the path doesn’t exist. What am I doing wrong?

You get the error log but I’m pretty sure that it is still returning null. That error log is not an exception so your Rule should still continue to execute.

Log out Annova_online and you can verify that it is returning null.

I don’t believe you can eliminate this error log statement without turning off logging for transformations entirely.