The date of json is converted to the Date type of java ( what time is passed and what time is displayed )
For example, the json data in "2012-11-02" format is converted to java.util.Date type. If there is a problem with the direct date conversion, the debug finds that the date is the current date of the system , not the json date conversion at all. To solve this problem is actually not difficult
jar package import:
json-lib-xxx.jar
ezmorph-xxx.jar
/ / Register a json to convert the date format of java.util.date
DateMorpher copied by yourself
String[] dateFormats = new String[] {"yyyy-MM-dd hh:mm:ss"}; JSONUtils.getMorpherRegistry().registerMorpher(new com.itm.weixin.until.DateMorpher(dateFormats));
JSONObject.toBean(JSONObject.fromObject(json), Object.class);
Tool class jar:
JSONUtils.getMorpherRegistry().registerMorpher( new DateMorpher(new String[] { "yyyy-MM-dd" }));
JSONObject.toBean(JSONObject.fromObject(json), Object.class);
The above is the sample code. The json in the second line is a json string, and object.class is the class of the javabean to be transferred, so that the date attribute can be converted into json so the date displayed