摘要:Java List
public JsonArray getStringListJsonArray(List list)
{
JsonParser parser = new JsonParser();
Type listType = new TypeToken(){}.getType();
Gson gson = new Gson();
String json = gson.toJson(list,listType);
JsonElement element = parser.parse(json);
return element.getAsJsonArray();
}