JSONException: not match : - ", info : pos 7, line 1, column 8[{rowId":10",jobNo":"12"},{"row_id":12",jobNo":"12"}] 转集合对象
时间: 2023-08-13 19:05:17 浏览: 70
你可以使用JSON库将该字符串转换为集合对象。在Java中,你可以使用`org.json`库或者`com.fasterxml.jackson.core`库来处理JSON数据。以下是使用`org.json`库的示例代码:
```java
import org.json.JSONArray;
import org.json.JSONException;
public class Main {
public static void main(String[] args) {
String jsonString = "[{\"rowId\":\"10\",\"jobNo\":\"12\"},{\"row_id\":\"12\",\"jobNo\":\"12\"}]";
try {
JSONArray jsonArray = new JSONArray(jsonString);
System.out.println(jsonArray);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
```
在这个例子中,我们首先导入`org.json.JSONArray`和`org.json.JSONException`类。然后,我们定义了一个包含你提供的JSON字符串的变量`jsonString`。在`try-catch`块中,我们使用`JSONArray`类将JSON字符串转换为JSONArray对象,并将其打印出来。
输出将是一个JSONArray对象,表示了你提供的JSON数据。你可以进一步使用该对象进行后续操作。请注意,你需要确保在使用之前正确引入和配置JSON库。
如果你使用的是其他编程语言或JSON库,可以参考相应的文档和示例代码进行处理。