json转换为java.util.Date日期类型(json-lib)

方法一:
import net.sf.ezmorph.MorpherRegistry;
import net.sf.ezmorph.object.DateMorpher;
import net.sf.json.util.JSONUtils;


/**
 * 自定义转为json需注册的Morpher
 * 
 * @author qiaoyao
 * @version 1.0,下午11:05:43
 */
public class CustomMorpherRegistry {

	public static final String[] DATE_FORMAT = { "yyyy-MM-dd HH:mm:ss" };

	
	public static void registerMorpher() {
		
		MorpherRegistry morpherRegistry = JSONUtils.getMorpherRegistry();
		morpherRegistry.registerMorpher(new DateMorpher(DATE_FORMAT));

	}

}

你可能感兴趣的:(java,json,.net)