我需要獲取回傳數字但不是 json 格式的端點的回應,只回傳一個數字。當我嘗試做 response.prettyprint() 時,我在控制臺中什么也沒看到。有沒有辦法在回應中獲取該數字?謝謝!
uj5u.com熱心網友回復:
要列印該資訊,只需使用:
Response res = ...
res.print();
要獲取 Infor,請將 Response 保存為,String然后將型別轉換為int
String res = ...asString();
int number = Integer.valueOf(res);
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/419465.html
標籤:
