Add two useful helpers: isValidJSON and parseJSON.