import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
@RequestMapping(value = "/{contentId}/newContent", method = RequestMethod.POST)
public String newContent(@RequestParam(required = true) String dataJson, HttpServletRequest request) throws Exception {
JSONArray parse = JSONArray.parseArray(dataJson);
JSONArray json = new JSONArray();
String jsonStr = "";
for (int i = 0; i < parse.size(); i++) {
JSONObject jsonObject = parse.getJSONObject(i);
jsonObject.remove("parentContentName");//去除多余的key value
json.add(jsonObject);
jsonStr = JSONObject.toJSONString(json);
}
List<Content> jsonContentList = new ObjectMapper().readValue(jsonStr, new TypeReference<List<Content>>() {//转换为实体类的list (Content是实体类)
});
return "";
}