需要用到有序的JSONObject对象时(比如生成摘要用到加密)
入参:param
出参:logParam
引用
import com.alibaba.fastjson.parser.Feature;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
代码
FeatureAccessoriesEntity featureAccessoriesEntity = JSONObject.toJavaObject(param, FeatureAccessoriesEntity.class);
String logStr = new ObjectMapper().writeValueAsString(featureAccessoriesEntity);
JSONObject logParam = JSONObject.parseObject(logStr, Feature.OrderedField);