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.

CPJSObjectCreateJSON Hates undefined

#151

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.

Reported by nciagra · November 25th, 2008 @ 10:42 AM

State: new
Milestone: none
Assigned to: Francisco Tolmasky Francisco Tolmasky

Activity

  1. Francisco Tolmasky
    Francisco Tolmasky
    • 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.

    November 26th, 2008 @ 04:47 AM

  2. Ross Boucher
    Ross Boucher

    If your method returns undefined, then the member will be excluded from the serialization.

    
    if (v !== undefined) {
        value[k] = v;
    } else {
        delete value[k];
    }
    

    December 5th, 2008 @ 06:39 PM

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.