Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-25-2012, 05:18 AM   PM User | #1
Jigar
New to the CF scene

 
Join Date: Oct 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Jigar is an unknown quantity at this point
Angry How to read child node from root node in json using java

library used com.google.gson

try{
JsonReader reader=new JsonReader(new FileReader("E:/nagesh workspace/practice/WebContent/jsnf/newProject.json"));

reader.beginObject();
while(reader.hasNext())
{

String name = reader.nextName();
System.out.println(name);
if("Student".equals(name))
{
System.out.println("student list count = "+name.);
}
else if (name.equals("Name")) {
System.out.println(reader.nextString());
} else if (name.equals("Address")) {
System.out.println(reader.nextString());
}
else
{
reader.skipValue();
}
}

reader.endObject();
reader.close();
}
catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

this is my code and it's give me error...
so plzzz help me if anyone know this.....
Jigar is offline   Reply With Quote
Reply

Bookmarks

Tags
java

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:36 PM.


Advertisement
Log in to turn off these ads.