import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonParser;
public class Test {
public static void main(String[] args) {
JsonParser jsonParser=new JsonParser();
String str="[{\"type\":\"numbers\",\"title\":\"序号\",\"width\":\"60px\"},{\"field\":\"name\",\"title\":\"业务或项目列表\",\"width\":\"600px\",\"status\":\"project\"},{\"field\":\"DNCXCKU9SVProjectTaskStatus\",\"title\":\"于宏扬\",\"align\":\"center\",\"width\":\"120px\",\"status\":\"people\"},{\"field\":\"JELS5HKXGJProjectTaskStatus\",\"title\":\"刘莹\",\"align\":\"center\",\"width\":\"120px\",\"status\":\"people\"},{\"field\":\"E5PAFQCCP3ProjectTaskStatus\",\"title\":\"吴青洋\",\"align\":\"center\",\"width\":\"120px\",\"status\":\"people\"},{\"id\":\"XRQTPL5BJ3\",\"name\":\"旧-零部件OE数据服务\",\"parentId\":\"0\",\"type\":\"1\",\"DNCXCKU9SVProjectTaskStatus\":null,\"JELS5HKXGJProjectTaskStatus\":1,\"E5PAFQCCP3ProjectTaskStatus\":null},{\"id\":\"XRQTPL5BJ3\",\"name\":\"旧-零部件OE数据服务\",\"parentId\":\"0\",\"type\":\"1\",\"DNCXCKU9SVProjectTaskStatus\":1,\"JELS5HKXGJProjectTaskStatus\":null,\"E5PAFQCCP3ProjectTaskStatus\":null},{\"id\":\"V9AZCFSX46\",\"name\":\"旧-CMMI5认证\",\"parentId\":\"0\",\"type\":\"1\",\"DNCXCKU9SVProjectTaskStatus\":null,\"JELS5HKXGJProjectTaskStatus\":null,\"E5PAFQCCP3ProjectTaskStatus\":1},{\"id\":\"24NVLVEY2J\",\"name\":\"后市场数据服务\",\"parentId\":\"xxxx\",\"type\":\"2\",\"DNCXCKU9SVProjectTaskStatus\":2,\"JELS5HKXGJProjectTaskStatus\":null,\"E5PAFQCCP3ProjectTaskStatus\":null},{\"id\":\"PE8CT8SUTG\",\"name\":\"后市场基础数据建设\",\"parentId\":\"xxxx\",\"type\":\"2\",\"DNCXCKU9SVProjectTaskStatus\":null,\"JELS5HKXGJProjectTaskStatus\":2,\"E5PAFQCCP3ProjectTaskStatus\":null},{\"id\":\"PE8CT8SUTG\",\"name\":\"后市场基础数据建设\",\"parentId\":\"xxxx\",\"type\":\"2\",\"DNCXCKU9SVProjectTaskStatus\":2,\"JELS5HKXGJProjectTaskStatus\":null,\"E5PAFQCCP3ProjectTaskStatus\":null},{\"id\":\"WSZZFB5JWZ\",\"name\":\"中国银保信业务沟通交流\",\"parentId\":\"xxxx\",\"type\":\"2\",\"DNCXCKU9SVProjectTaskStatus\":2,\"JELS5HKXGJProjectTaskStatus\":null,\"E5PAFQCCP3ProjectTaskStatus\":null},{\"id\":\"G73XC2V3N8\",\"name\":\"车险理赔复合事件数据建设与防渗漏应用研发\",\"parentId\":\"xxxx\",\"type\":\"2\",\"DNCXCKU9SVProjectTaskStatus\":2,\"JELS5HKXGJProjectTaskStatus\":null,\"E5PAFQCCP3ProjectTaskStatus\":null}]";
JsonArray jsonArray=jsonParser.parse(str).getAsJsonArray();
String ttt=jsonArray.toString();
System.out.println(ttt);
}
}
今天的文章JAVA: Gson JsonArray和String 转换分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/27161.html