GeeCON Prague 2014*
The moose likes JSP and the fly likes Parsing an JSONArray on to JSP Page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Parsing an JSONArray on to JSP Page" Watch "Parsing an JSONArray on to JSP Page" New topic
Author

Parsing an JSONArray on to JSP Page

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234


Hi ,

Please tell me this : How can i parse an JSONArray Object

List mybeanList = new ArrayList();
mybeanList.add("S");
mybeanList.add("b");

JSONArray jsonA = JSONArray.fromObject(mybeanList);



Thanks in advance .


Save India From Corruption - Anna Hazare.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Waiting for answer .
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18875
    
  40



I have never used this class myself, but a quick google... it says that the JSON is generated via the toString() method. Doesn't that mean that you should call the method when generating your javascript -- maybe in an assigment, so your javascript can use the result that was calculated by the JSP?

Or are you referring to a different type of parsing here?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61313
    
  66

Ravi Pavan wrote:Waiting for answer .
Please read this.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
GeeCON Prague 2014
 
subject: Parsing an JSONArray on to JSP Page