00025-工具类CommonJsonUtils:json 与 bean的转换
标签:def array auth ++ HERE tst jlist @param gis
package com.xmdishi.fmp.utils;
import net.sf.json.util.JSONUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
/**
* json 与 bean的转换
* chenjianquan
* 2019/1/14
*/
public class CommonJsonUtils {
/**
* json转为List
* @author cjianquan
* @date 2020/1/19
* @param [json, clazz]
* @return java.util.List
*/
public List toBeanList(String json,Class clazz){
//调用DateMorpherEx,defaultValue为null
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpherEx(new String[] { "yyyy-MM-dd HH:mm:ss","yyyy-MM-dd" }, (Date) null));
net.sf.json.JSONArray jsonArr = net.sf.json.JSONArray.fromObject(json);
List list = new ArrayList();
for (int i = 0; i
* @author cjianquan
* @date 2020/1/19
* @param [json, key, clazz]
* @return java.util.List
*/
public List toBeanListByKey(String json,String key,Class clazz){
//调用DateMorpherEx,defaultValue为null
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpherEx(new String[] { "yyyy-MM-dd HH:mm:ss","yyyy-MM-dd" }, (Date) null));
List
00025-工具类CommonJsonUtils:json 与 bean的转换
标签:def array auth ++ HERE tst jlist @param gis
原文地址:https://www.cnblogs.com/jianquan100/p/13667888.html
评论