Check if input is an array

In some cases the $input value (after fromJSON conversion) is not an array, in which case the logs can fill php notices/errors. Added this simple check to avoid that.