03.09.2020, 08:25
decode will just stop the script if JSON is not valid. pdecode should be used if you want your script to continue in case of an error, this is sometimes more convenient if you want to log the error. The most correct approach is to check that the decoded data is a table and it contains all the required fields.
Code:
if type(data) == 'table' and type(data.indicator) == 'table' then
log(data.indicator.short_name)
end