-3
Gsonライブラリを使用して次のデータを解析します。Gsonライブラリを使用したAndroid JSON解析
{
"claimTypeList": [
"Dental",
"Outpatient",
"Hospitalisation/Surgery"
]
}
Gsonライブラリを使用して次のデータを解析します。Gsonライブラリを使用したAndroid JSON解析
{
"claimTypeList": [
"Dental",
"Outpatient",
"Hospitalisation/Surgery"
]
}
@Generated("org.jsonschema2pojo")
public class Example {
@SerializedName("claimTypeList")
@Expose
private List<String> claimTypeList = new ArrayList<String>();
/**
*
* @return
* The claimTypeList
*/
public List<String> getClaimTypeList() {
return claimTypeList;
}
/**
*
* @param claimTypeList
* The claimTypeList
*/
public void setClaimTypeList(List<String> claimTypeList) {
this.claimTypeList = claimTypeList;
}
}
この
public class Claims {
List<String> claimTypes;
}
そして、ここのようなモデルクラスを作成します
String data = "{\"claimTypeList\":[\"Dental\",\"Outpatient\",\"Hospitalisation/Surgery\"]}"
Claims c = new Claims();
c = new Gson().FromJson(data, Claims.class);
オブジェクトためにあなたの文字列を変換これが役立つことを願っています。