I am reading data from The Joys of Code. The API returns data in JSON format where boolean variables are written as so:
{ "obj" :
{
"sharing":false,
"modified":"tuesday"
}
}
Notice, sharing:false does not have quotation marks around the word false. I am then using NSJSONSerialization to parse this JSON into an object (NSDictionary in this example).
The problem is, “sharing”:false or “sharing”:true is always creating an object with sharing = 0, where 0 is an NSNumber with value 0.
My question is if this is valid JSON and NSJSONSerialization is not working correctly, or if the original JSON is invalid.
NSJSONSerialization works fine for me with the above json (putting in false and true) :