0
私は現在Yelp Fusion APIを使用してビジネス情報を取得しています。これまでのところ私はPOST要求に対する応答を得ることができましたが、JSON全体の出力しか得られませんでした。結果をフィルタリングする方法はありますか?したがって、特定のキーとJSON出力の値を取得するだけです。私のコードは、これまでに以下に示します。POST応答の処理
try {
String req = "https://api.yelp.com/v3/businesses/search?";
req += "term=" + term + "&location=" + location;
if(category != null) {
req += "&category=" + category;
}
URL url = new URL(req);
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Authorization", "Bearer " + ACCESSTOKEN);
BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream()));
StringBuffer buffer = new StringBuffer();
String inputLine = reader.readLine();
buffer.append(inputLine);
System.out.println(buffer.toString());
reader.close();
} catch (Exception e) {
System.out.println("Error Connecting");
}
おかげ