用java语言将[{"column":"account_uuid","desc":"用户的uid","filed":"accountUuid","val":"bgibdeeaghbfhbdf"},{"column":"cost_amount","desc":"用户消费礼物的趣豆","filed":"costAmount","val":0},{"column":"receive_amount","desc":"公会分成后可提现趣豆总收益","filed":"receiveAmount","val":0},{"column":"reward_amount","desc":"公会总提现金额","filed":"rewardAmount","val":0},{"column":"person_receive_amount","desc":"个人分成后可提现趣豆总收益","filed":"personReceiveAmount","val":3},{"column":"person_reward_amount","desc":"个人总提现金额","filed":"personRewardAmount","val":0},{"column":"gift_amount","desc":"礼物收益","filed":"giftAmount","val":10},{"column":"consortia_id","desc":"公会id","filed":"consortiaId","val":0},{"column":"is_personal","desc":"是否素人","filed":"isPersonal","val":1}] 转成json对象List
时间: 2023-07-03 14:27:51 浏览: 129
可以使用以下代码将该字符串转换为 JSON 对象 List:
```java
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
String jsonStr = "[{\"column\":\"account_uuid\",\"desc\":\"用户的uid\",\"filed\":\"accountUuid\",\"val\":\"bgibdeeaghbfhbdf\"},{\"column\":\"cost_amount\",\"desc\":\"用户消费礼物的趣豆\",\"filed\":\"costAmount\",\"val\":0},{\"column\":\"receive_amount\",\"desc\":\"公会分成后可提现趣豆总收益\",\"filed\":\"receiveAmount\",\"val\":0},{\"column\":\"reward_amount\",\"desc\":\"公会总提现金额\",\"filed\":\"rewardAmount\",\"val\":0},{\"column\":\"person_receive_amount\",\"desc\":\"个人分成后可提现趣豆总收益\",\"filed\":\"personReceiveAmount\",\"val\":3},{\"column\":\"person_reward_amount\",\"desc\":\"个人总提现金额\",\"filed\":\"personRewardAmount\",\"val\":0},{\"column\":\"gift_amount\",\"desc\":\"礼物收益\",\"filed\":\"giftAmount\",\"val\":10},{\"column\":\"consortia_id\",\"desc\":\"公会id\",\"filed\":\"consortiaId\",\"val\":0},{\"column\":\"is_personal\",\"desc\":\"是否素人\",\"filed\":\"isPersonal\",\"val\":1}]";
JSONArray jsonArray = JSON.parseArray(jsonStr);
List<Object> jsonList = jsonArray.toJavaList(Object.class);
```
这里使用了阿里巴巴的 fastjson 库。需要先将字符串转换成 JSONArray,再将 JSONArray 转换为 List。
阅读全文