isValidJSONObject not working as expected
isValidJSONObject
tests if a JSON object (a NSDictionary
or NSArray
) can be successfullyconverted to JSON data.
It is not for testing if an NSData
object contains valid JSON data. To test for valid JSON data you just call
[NSJSONSerialization JSONObjectWithData:data ...]
and check if the return value is nil
or not.