Fix for handling json object or array as input