CPJSObjectCreateJSON Hates undefined
Reported by nciagra | November 25th, 2008 @ 10:42 AM
If you ever pass an undefined value to CPJSObjectCreateJSON, well it really doesn't like that. It throws a very nondescript error, however Francisco and I have determined that it is due to an undefined value. I feel that the desired behavior would be to output "null", just like you do for CPNull or nil.
Comments and changes to this ticket
-
Francisco Tolmasky November 26th, 2008 @ 04:47 AM
- Assigned user set to Francisco Tolmasky
We should see what http://www.json.org/json2.js does, and also take the opportunity to bring it into cappuccino since I think we have an outdated version. We should probably keep the namespace stuff to, and just have it be CPJSObjectCreateJSON AND JSON.parse() etc.
-
Ross Boucher December 5th, 2008 @ 06:39 PM
If your method returns undefined, then the member will be excluded from the serialization.
if (v !== undefined) { value[k] = v; } else { delete value[k]; }
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.
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.