aspose file tools*
The moose likes Struts and the fly likes JSON object containing customer object, throws error. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "JSON object containing customer object, throws error." Watch "JSON object containing customer object, throws error." New topic
Author

JSON object containing customer object, throws error.

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Hi guys,

Just wondering if someone could help with my JSON issue.
I have a list of objects called Company that contain details such as ID, name, address etc.
I pass these back to a JSP, but I just get the following error.
Now if I replace the jsonData.put("companyList", this.companyList); with someting simple like
jsonData.put("companyList", "A pointless string");, the code works, which would suggest the List and/or Company object is
the problem, but I can't think why. PS, the Company object is Serializable.

Any help greatly appreciated.


struts.xml


Java


JSP


Error:
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

The error is that you're running out of memory. So the problem isn't necessarily that JSON can't deal with your customer object, it's that there are too many of them.
Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Which is odd as the List is only returning 3 Company objects.
Pavlos Dedousis
Greenhorn

Joined: Apr 23, 2012
Posts: 1
As far as your issue still exists, you may find the 4th step of the following article useful: http://javanus.com/blogs/?tag=org-apache-struts2-json-jsonwriter-add
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSON object containing customer object, throws error.