编程语言
首页 > 编程语言> > Java List转 JSONObject

Java List转 JSONObject

作者:互联网

Java List转 JSONObject

pom.xml

    <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
            <version>4.5.7</version>
        </dependency>

实现:

List<Object> list= new ArrayList<>();
JSONArray jsonArray = JSONUtil.parseArray(list);

JSONObject jsonObject = jsonArray.toJSONObject(jsonArray);

 

标签:Java,jsonArray,List,list,hutool,JSONObject
来源: https://www.cnblogs.com/lizm166/p/16608247.html