如果我这样做:
public static volatile ArrayList<Process> processes = new ArrayList<Process>(){
{
add(new Process("News Workflow", "This is the workflow for the news segment", "image"));
}
};
然后这个:
String jsonResponse = gson.toJson(processes);
jsonResponse 为空。
但如果我这样做:
public static volatile ArrayList<Process> processes = new ArrayList<Process>();
processes.add(new Process("nam", "description", "image"));
String jsonResponse = gson.toJson(processes);
Json 响应是:
[{"name":"nam","description":"description","image":"image"}]
这是为什么?