JSON字符串转数组
时间: 2023-09-03 13:14:39 浏览: 110
JSON 转 数组方法
要将JSON字符串转换为数组,可以使用不同编程语言中的JSON解析库。以下是一种 Java 的例子:
```java
String str = "[{name:'a',value:'aa'},{name:'b',value:'bb'},{name:'c',value:'cc'},{name:'d',value:'dd'}]";
JSONArray json = JSONArray.fromObject(str);
List<Map<String, Object>> list = new ArrayList<>();
if (json.size() > 0) {
for (int i = 0; i < json.size(); i++) {
JSONObject job = json.getJSONObject(i);
#### 引用[.reference_title]
- *1* *2* *3* [json字符串数组转json数组](https://blog.csdn.net/m0_46742141/article/details/119644728)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文