Validate JSON

Check if a string is valid JSON.

Code

General
json_decode($str);
return json_last_error() === JSON_ERROR_NONE;

Parameters

The string to validate as JSON

Server

More PHP Snippets