Answers for "how to get json in java"

1

how to read a .json from web api java

try {
			URL url = new URL("url");
			HttpURLConnection conn = (HttpURLConnection)url.openConnection();
			conn.setRequestMethod("GET");
			conn.connect();
			if(conn.getResponseCode() == 200) {
				Scanner scan = new Scanner(url.openStream());
				while(scan.hasNext()) {
					String temp = scan.nextLine();
                  	//parse json here
                }
            }
}
Posted by: Guest on August-31-2020
0

java find in json

<dependency>
    <groupId>com.jayway.restassured</groupId>
    <artifactId>json-path</artifactId>
    <version>2.4.0</version>
</dependency>
Posted by: Guest on April-28-2021

Code answers related to "how to get json in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language