私はJSON creations
を初めて使用しています。 for-eachループ内の各要素のJSONオブジェクトを作成したいと思います。私のコードは次のとおりですJavaを使用してJSONオブジェクトを作成する
for(int i=0 ; i<=childclasses.size() ;i++){
for (OInstance oinstance:oinstances){
oinstancelist.add(oinstance);
}
}
try {
object.put("subclass",oclass);
object.put("instance", oinstancelist);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("json is " +object);
oinstanceごとにjsonオブジェクトを作成したいと思います。だから、どうすればいい? Gsonで