fastJson-對象轉map

CallbackEntity callbackEntity = new CallbackEntity();
callbackEntity.setUserId(infos.get(3)); //用戶id
callbackEntity.setOrderId(infos.get(0)); //訂單id
callbackEntity.setChannel(infos.get(4));//渠道
callbackEntity.setType(infos.get(1)); //類型
callbackEntity.setSubType(infos.get(2)); //子類型
callbackEntity.setStrategyId(dec.getStrategyId()); //	決策流id
callbackEntity.setStrategyVersion(dec.getStrategyVersion());//決策流版本
callbackEntity.setStrategyName(dec.getStrategyName()); //決策流名字
callbackEntity.setAdditions(dec.getParams()); //附加信息
callbackEntity.setCode(Integer.parseInt(dec.getResultCode())); //code=0,爲拒絕;code=1,爲通過 -1爲異常
Map<String, Object> ben2Map =
    JSON.parseObject(JSON.toJSONString(callbackEntity, SerializerFeature.WriteNullStringAsEmpty, SerializerFeature.WriteNullNumberAsZero, SerializerFeature.WriteMapNullValue), Map.class);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章