#275 new
Martin Häcker

Can't serialize correct JSON

Reported by Martin Häcker | April 27th, 2009 @ 01:36 AM

Hi there,

I tried serializing this json


    var json = {
        "basic_properties": [{"rendered": 1, "name": "id", "value": 1, "label": "id"}, 
                             {"rendered": "Some summary", "name": "summary", "value": "Some summary", "label": "summary"}, 
                             {"rendered": "dwt", "name": "reporter", "value": "dwt", "label": "reporter"}, 
                             {"rendered": "dwt", "name": "owner", "value": "dwt", "label": "owner"}, 
                             {"rendered": "Some description\r\n\r\n * With formatted list\r\n * of two items\r\n\r\nand a #2 link", "name": "description", "value": "Some description\r\n\r\n * With formatted list\r\n * of two items\r\n\r\nand a #2 link", "label": "description"}, 
                             {"rendered": "requirement", "name": "type", "value": "requirement", "label": "type"}, 
                             {"rendered": "new", "name": "status", "value": "new", "label": "status"}, 
                             {"rendered": "fixed", "name": "resolution", "value": "fixed", "label": "resolution"}], 
        "calculated_properties": [{"rendered": "2.0", "name": "total_story_points", "value": 2.0, "label": "Total Story Points"}, 
                                  {"rendered": "n.a.", "name": "roif", "value": null, "label": "Roif"}, 
                                  {"rendered": "n.a.", "name": "mandatory_story_points", "value": null, "label": "Mandatory Story Points"}], 
        "type_properties": [{"rendered": "milestone1", "name": "milestone", "value": "milestone1", "label": "milestone"}, 
                            {"rendered": "asdf", "name": "keywords", "value": "asdf", "label": "keywords"}, 
                            {"rendered": "3000", "name": "businessvalue", "value": "3000", "label": "businessvalue"}], 
        "in_links": [], 
        "out_links": [{"id": 2}]
    };
    // FIXME: somehow the json conversion bombs - not sure why.
    [CPString JSONFromObject:json];

It dies on trying to serialize the null values.

Please fix it. :)

Martin

Comments and changes to this ticket

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