Check if $data is an array or an object.