src/JSONTools.php
public static function getJSONErrorAsString()
	{
		switch(json_last_error())
		{
			case JSON_ERROR_NONE:
				$error =  NULL;
			break;
			
			case JSON_ERROR_DEPTH:
				$error = 'The maximum stack depth has been exceeded.';
			break;
				
			case JSON_ERROR_STATE_MISMATCH:
				$error = 'Invalid or malformed JSON.';
			break;

			case JSON_ERROR_CTRL_CHAR:
				$error = 'Control character error, possibly incorrectly encoded.';
			break;

			case JSON_ERROR_SYNTAX:
				$error = 'Syntax error, malformed JSON.';
			break;

			// PHP >= 5.3.3
			case JSON_ERROR_UTF8:
				$error = 'Malformed UTF-8 characters, possibly incorrectly encoded.';
			break;

			// PHP >= 5.5.0
			case JSON_ERROR_RECURSION:
				$error = 'One or more recursive references in the value to be encoded.';
			break;

			// PHP >= 5.5.0
			case JSON_ERROR_INF_OR_NAN:
				$error = 'One or more NAN or INF values in the value to be encoded.';
			break;

			case JSON_ERROR_UNSUPPORTED_TYPE:
				$error = 'A value of a type that cannot be encoded was given.';
			break;

			default:
				$error = NULL;
			break;
		}
		
		return $error;
	}
public static function getJSONErrorAsString()
	{
		switch(json_last_error())
		{
			case JSON_ERROR_NONE:
				$error =  NULL;
			break;
			
			case JSON_ERROR_DEPTH:
				$error = 'The maximum stack depth has been exceeded.';
			break;
				
			case JSON_ERROR_STATE_MISMATCH:
				$error = 'Invalid or malformed JSON.';
			break;

			case JSON_ERROR_CTRL_CHAR:
				$error = 'Control character error, possibly incorrectly encoded.';
			break;

			case JSON_ERROR_SYNTAX:
				$error = 'Syntax error, malformed JSON.';
			break;

			// PHP >= 5.3.3
			case JSON_ERROR_UTF8:
				$error = 'Malformed UTF-8 characters, possibly incorrectly encoded.';
			break;

			// PHP >= 5.5.0
			case JSON_ERROR_RECURSION:
				$error = 'One or more recursive references in the value to be encoded.';
			break;

			// PHP >= 5.5.0
			case JSON_ERROR_INF_OR_NAN:
				$error = 'One or more NAN or INF values in the value to be encoded.';
			break;

			case JSON_ERROR_UNSUPPORTED_TYPE:
				$error = 'A value of a type that cannot be encoded was given.';
			break;

			default:
				$error = NULL;
			break;
		}
		
		return $error;
	}
public static function getJSONErrorAsString ( ) { switch ( json_last_error ( ) ) { case JSON_ERROR_NONE : $ error = NULL ; break ; case JSON_ERROR_DEPTH : $ error = 'The maximum stack depth has been exceeded.' ; break ; case JSON_ERROR_STATE_MISMATCH : $ error = 'Invalid or malformed JSON.' ; break ; case JSON_ERROR_CTRL_CHAR : $ error = 'Control character error, possibly incorrectly encoded.' ; break ; case JSON_ERROR_SYNTAX : $ error = 'Syntax error, malformed JSON.' ; break ; // PHP >= 5.3.3 case JSON_ERROR_UTF8 : $ error = 'Malformed UTF-8 characters, possibly incorrectly encoded.' ; break ; // PHP >= 5.5.0 case JSON_ERROR_RECURSION : $ error = 'One or more recursive references in the value to be encoded.' ; break ; // PHP >= 5.5.0 case JSON_ERROR_INF_OR_NAN : $ error = 'One or more NAN or INF values in the value to be encoded.' ; break ; case JSON_ERROR_UNSUPPORTED_TYPE : $ error = 'A value of a type that cannot be encoded was given.' ; break ; default : $ error = NULL ; break ; } return $ error ; }
returns a string representation of the last JSON error

@return string The error string. NULL, if no error was found
returns a string representation of the last JSON error