// Before

$payload = json_encode($response);

$data = json_decode($input, true);

$ok = json_validate($input);

// After