JSON, jsp struts2,
@Result(name = SUCCESS, type = JSON, params = {
"ignoreHierarchy", "false", "includeProperties","bookList\\[\\d+\\]\\..*})
jquery post , .
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
ObjectMapper mapper = new ObjectMapper();
mapper.getSerializationConfig().setDateFormat(sd);
bookListJsonString= mapper.writeValueAsString(bookList);
ObjectMapper objectMapper=new ObjectMapper();
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
objectMapper.getDeserializationConfig().setDateFormat(sd);
objectMapper.getDeserializationConfig().disable(Feature.FAIL_ON_UNKNOWN_PROPERTIES); //To avoid failure if there is no any class fields.
List<BooksDocument> bookList = objectMapper.readValue(bookListJsonString, new TypeReference<List<BooksDocument>>() {});
- . , .