Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

bug in CPString JSONFromObject: when using null

#253

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]);

Reported by Philippe Laval · March 15th, 2009 @ 11:57 AM

State: new
Milestone: none
Assigned to: Tom Robinson Tom Robinson

Activity

No comments yet.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.