struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stanley, Eric" <Eric.R.Stan...@qwest.com>
Subject JSON plugin
Date Thu, 13 Mar 2008 20:30:55 GMT
I am trying to use dojo and the JSON plugin, but I have hit a snag. I am
using JSON to serialize: ArrayList<Project> projectList.
 
It seems to do this fine, as I can see the result in firebug. The
problem I am having is that the JSON response seems to be missing
something, and I cant figure out how to remedy this. 
 
This is the dojo example json:
{ "cobblers": [
       {"filling": "peach", "timeToBake": 30 },
       {"filling": "cherry", "timeToBake": 35 },
       {"filling": "blueberry", "timeToBake": 30}
    ]
}
 
This is how they parse it (abbreviated):
console.dir(responseObject.cobblers[0].filling);  // Prints "peach"
 
In my code I run "console.dir(responseObject);" and get this displayed
in firebug:
[
    {
        "acdate":null,
        "approved":false,
        "id":236,
        "lead":{"cuid":"hsimpso","id":2,"name":null,"role":2},
        "loe":{"id":2,"name":"Medium"},
        "mos":"Create something.",
        "name":"Alarming page",
        "owner":{"cuid":"mburns","id":14,"name":null,"role":0},
        "priority":{"id":1,"name":"High"},
        "result":"Waiting on something",
        "status":{"hlaOnly":null,"id":6,"name":"OnHold"},
        "stdate":"2006-03-14T00:00:00",
        "tcdate":"2006-05-12T00:00:00"
    },
 
    {
        "acdate":"2008-02-01T00:00:00",
        "approved":false,
        "id":1749,
        "lead":{"cuid":"mxsimps","id":2,"name":null,"role":2},
        "loe":{"id":4,"name":"Extra Large"},
        "mos":"Rewrite stuff.",
        "name":"Rewrite that",
        "owner":{"cuid":"mburns","id":14,"name":null,"role":0},
        "priority":{"id":1,"name":"High"},
        "result":"I done did it....",
        "status":{"hlaOnly":null,"id":4,"name":"Completed"},
        "stdate":"2007-07-16T00:00:00",
        "tcdate":"2008-02-01T00:00:00"
    }
]
 
That seems okay to me. I hit the snag when I try something like this:
console.debug(responseObject.projectList[0].name);
 
This is whats returned:
 responseObject.projectList has no properties
 
Im not sure how to address the response. Any ideas?
 
-Ryan


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.

Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message