Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Web サービスから応答を得ています :-
response = [{"result":"false"}]
これを解析する方法がわかりません
ありがとうアドバンス。
JSONObjet obj = response.getJSONObject(0); String result = obj.getString("result");
これでうまくいくはずです。 複数のオブジェクトを解析しようとしている場合は、afor-loopを使用できます。フィールドがあるかどうかわからない場合は、次の行を使用できます。
for-loop
if(obj.has("result"){ String result = obj.getString("result"); }