Fastest way to check if a string is JSON in PHP? June 12, 2022 by Tarik function isJson($string) { json_decode($string); return json_last_error() === JSON_ERROR_NONE; }