转为实体类对象，转换异常将被抛出

@param <T> Bean类型
@param json JSONObject
@param beanClass 实体类对象
@return 实体类对象
554816
public static <T> T toBean(JSONObject json, Class<T> beanClass) {
		return null == json ? null : json.toBean(beanClass);
	}
1252489
private static JsonObject getJsonObject(Set<Attribute> columns, Object object)
    {
        JsonObject jsonObject = new JsonObject();
        for (Attribute column : columns)
        {
            if (!column.isAssociation())
            {
                Object valueObject = PropertyAccessorHelper.getObject(object, (Field) column.getJavaMember());
                jsonObject.add(((AbstractAttribute) column).getJPAColumnName(),
                        getJsonPrimitive(valueObject, column.getJavaType()));
            }
        }
        return jsonObject;
    }
245330
public static <E> String serialize(Map<String, E> map, Class<E> jsonObjectClass) throws IOException {
        return mapperFor(jsonObjectClass).serialize(map);
    }
155836
static Object getObjectFromJson(JsonObject jsonObj, Class clazz, Set<Attribute> columns)
    {
        Object obj = KunderaCoreUtils.createNewInstance(clazz);
        for (Attribute column : columns)
        {
            JsonElement value = jsonObj.get(((AbstractAttribute) column).getJPAColumnName());
            setFieldValue(obj, column, value);
        }
        return obj;
    }
555588
public static final Class getType(Object bean, String property)
    {
        return (Class) doFor(bean, property, null, BeanHelper::getObjectType, BeanHelper::getObjectType, BeanHelper::getFieldType, BeanHelper::getMethodType);
    }
1240938
public static <E> String serialize(List<E> list, Class<E> jsonObjectClass) throws IOException {
        return mapperFor(jsonObjectClass).serialize(list);
    }
95285
@SuppressWarnings("unchecked")
	public static<X> Map<String, X> toMap(String json, Class<X> valClass) {
		Map<String, X> map = new HashMap<String, X>();
		try {
			JsonFactory f = new JsonFactory();
			JsonParser jp = f.createJsonParser(json);
			jp.nextToken(); // will return JsonToken.START_OBJECT (verify?)
			while (jp.nextToken() != JsonToken.END_OBJECT) {
				JsonToken token = jp.getCurrentToken();
				if(token.equals(JsonToken.FIELD_NAME)) {
					jp.nextToken();// to value token
					if(valClass.equals(Integer.class) || valClass.equals(int.class) ) {
						map.put(jp.getCurrentName(), (X) Integer.valueOf(jp.getIntValue()));
					} else if (valClass.equals(String.class)) {
						map.put(jp.getCurrentName(), (X) jp.getText());
					} else if (valClass.equals(Boolean.class) || valClass.equals(boolean.class)) {
						map.put(jp.getCurrentName(), (X) Boolean.valueOf(jp.getBooleanValue()));
					}
				}
			}
			jp.close();
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return map;
	}
489592
public static <T> Map<String, Object> toMap(T bean) {
        Map<String, Object> map = null;
        try {
            map = PropertyUtils.describe(bean);
            map.remove("class");
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return map;
    }
1116049
public static <T> T fromJSON(String json, Class<T> classOfT) {
    return gson.fromJson(json, classOfT);
  }
1321039
@SuppressWarnings("unchecked")
    public static <T extends BaseBo> T fromJson(String json, Class<T> clazz,
            ClassLoader classLoader) {
        if (StringUtils.isBlank(json) || clazz == null) {
            return null;
        }
        try {
            Map<String, Object> data = SerializationUtils.fromJsonString(json, Map.class);
            String boClassName = DPathUtils.getValue(data, FIELD_CLASSNAME, String.class);
            T bo = createObject(boClassName, classLoader, clazz);
            if (bo != null) {
                bo.fromJson(DPathUtils.getValue(data, FIELD_BODATA, String.class));
                return bo;
            } else {
                return null;
            }
        } catch (Exception e) {
            throw e instanceof DeserializationException ? (DeserializationException) e
                    : new DeserializationException(e);
        }
    }
883363
public static <T> JacksonParser<T> json(Class<T> contentType) {
        return new JacksonParser<>(null, contentType);
    }
939779
public static String toJsonStringByAnnotation(Object object) throws IllegalAccessException {
        JsonType jsonType = JsonType.CONDENSED;
        FieldModifier modifier = FieldModifier.ALL;
        JsonMethod method = JsonMethod.AUTO;
        if (Checker.isNotNull(object)) {
            Class<?> bean = object.getClass();
            if (bean.isAnnotationPresent(ToJsonString.class)) {
                ToJsonString annotation = bean.getAnnotation(ToJsonString.class);
                jsonType = annotation.type();
                modifier = annotation.modifier();
                method = annotation.method();
            }
        }
        String json = toJsonString(object, modifier, method);
        return jsonType == JsonType.PRETTY ? Formatter.formatJson(json) : json;
    }
881700
public static BaseBo fromJson(String json, ClassLoader classLoader) {
        return fromJson(json, BaseBo.class, classLoader);
    }
21903
public static <T> T mapToBean(Map<?, ?> map, Class<T> beanClass, boolean isIgnoreError) {
		return fillBeanWithMap(map, ReflectUtil.newInstance(beanClass), isIgnoreError);
	}
131826
public <T> T fromJson(String json, Class<T> clazz) {
        if (json == null || json.trim().length() == 0) {
            return null;
        }

        try {
            return mapper.readValue(json, clazz);
        } catch (IOException e) {
            logger.warn("fromJson出错:" + json, e);
            return null;
        }
    }
473992
public static <T> Optional<T> toBean(String json, Class<T> clazz) {
        if (StringUtils.isBlank(json)) {
            log.warn("json is blank. ");
            return Optional.empty();
        }
        try {
            OBJECT_MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
            return Optional.of(OBJECT_MAPPER.readValue(json, clazz));
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            return Optional.empty();
        }
    }
670647
public Map<String, Object> jsonToMap(String json) {

        /*
         * This if block treats the /v2/accounts/exists response. Currently the endpoint returns the status
         * code on its response body, breaking the JSON conversion.
         */
        if ("200".equals(json)) {
            this.responseBody.put("code", 200);
            return this.responseBody;
        }

        if ("400".equals(json)) {
            this.responseBody.put("code", 400);
            return this.responseBody;
        }

        if ("404".equals(json)) {
            this.responseBody.put("code", 404);
            return this.responseBody;
        }

        if (!json.equals("")) {
            ObjectMapper mapper = new ObjectMapper();
            try {
                this.responseBody = mapper.readValue(json, new TypeReference<Map<String, Object>>(){});
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return this.responseBody;
    }