程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> json-從Json對象中獲取字符串值

json-從Json對象中獲取字符串值

編輯:編程綜合問答
從Json對象中獲取字符串值

在我的應用程序中,我從HTTP Response獲取以下的json。

[{"Date":"2012-1-4T00:00:00","keywords":null,"NeededString":"this is the sample string I am needed for my project","others":"not needed"}]

我想從上面的json中獲得 "NeededString" ,如何實現呢?

最佳回答:


String str="{"Date":"2012-1-4T00:00:00","keywords":null,"NeededString":"this is the sample string I am needed for my project","others":"not needed"}";

轉義不寫了,說下

JsonObject jobj=new JsonObject(str);
String needStr=jobj.getStrig("NeededString");
ssummeraw
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved