ParseJSON

<dependency>


<groupId>org.json</groupId>


<artifactId>json</artifactId>


<version>20090211</version>


</dependency>


<dependency>


<groupId>com.googlecode.json-simple</groupId>


<artifactId>json-simple</artifactId>


<version>1.1.1</version>


</dependency> 








public class test {

String n;


public String readJSONData(String keyword) throws IOException, ParseException {

JSONParser parser = new JSONParser();

JSONArray jsonArr = (JSONArray)parser.parse(resp);

for(Object obj : jsonArr){

JSONObject jo = (JSONObject)obj;

n = (String)jo.get(keyword);

}

return n;


} public static void main(String[] args) throws IOException, ParseException {

test e = new test();


String a = e.readJSONData("blog URL");

    System.out.println(a);

}


}

Comments

Popular posts from this blog

The self healing automation framework - Healenium Updated Dec2023

Heleanium - Web without using Docker