#253 new
Philippe Laval

bug in CPString JSONFromObject: when using null

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

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

No comments found

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Cappuccino Web Framework, including AppKit, Foundation, and Objective-J.

Shared Ticket Bins

People watching this ticket

Pages