As usual : Mac OS 10.5 with safari 4 beta. I got an TypeError:
Result of expression '_14' [null] is not an object When I change
null by a string everything is OK.
The reverse is not true, we can transforme @"{test=null}" into
an javascript object.
var myFirstJSONObject = { "firstName" : "John",
"lastName" : "Doe",
"age" : 23,
"tangoDancer" : true,
"rich" : false,
// "bankAccountInSwitzerland" : null generates an error in JSONFromObject
"bankAccountInSwitzerland" : null}; // "None"
// Add some other properties to the object
myFirstJSONObject.isFrench = false;
myFirstJSONObject.favoriteNumbers = [10, 3, 1968];
myFirstJSONObject["isAmerican"] = true;
// null is NOT accepted
// TypeError: Result of expression '_14' [null] is not an object.
// Get the JSON representation of the object
var text = [CPString JSONFromObject:myFirstJSONObject];
CPLog.trace(@"text: " + [text description]);