【发布时间】:2021-07-09 08:31:28
【问题描述】:
我使用 Newtonsoft.json 来反序列化这个 json
{
"pdf_info": [
[
-> this is a object {
"order_serial_no": "xxxxx",
// more properties
},
-> this is an array ["xxxx", "x"]
]
]
}
在java中我可以使用下面的代码来实现。
JSONArray pdfArray = JSONArray.parseArray(pdf_info);
String pdfArrayOne = pdfArray.getString(0);
JSONArray jsonArray = JSONObject.parseObject(pdfArrayOne, JSONArray.class);
String jsonData = jsonArray.getString(0);
Pdf pdf = JSONObject.parseObject(jsonData, Pdf.class);
那么,如何用 newtonsoft.json 反序列化这个 json
【问题讨论】:
-
那不是有效的 JSON,所以你不能。
-
@Llama 我认为'-> this is an...' 字符串应该是 cmets,而不是 json 的实际内容... :)