我有这个 json 字符串:
{"work_completion_forms":
[
{
"id": "2a6aae87-af4f-4aa9-8e43-05af2be6d963",
"name": "File"
},
{
"id": "b6e35c72-026e-4ef0-8eff-36d040054a93",
"name": "Comment"
}
]
}
我如何解析它?
我试试这个:
Gson g = new Gson();
Parse p = g.fromJson(result, Parse.class);
String[] s = p.get_work_completion_forms();
for (int i = 0; i < s.length;i++){
Log.d(s[i], "lol");
}
public class Parse {
public String[] work_completion_forms;
public String[] get_work_completion_forms()
{
return work_completion_forms;
}
}