Added workaround for the json_last_error() function

It doesn't exist in prior versions of PHP 5.3.0