我正在尝试反序列化从Web服务获得的JSON响应。我正在尝试使用NewtonSoft Json。净额。
我正在尝试解析响应
var results = JArray.Parse(response.Content);
我得到以下异常
Newtonsoft。Json。发生JsonReaderException HResult=0x80131500
消息=从JsonReader读取JArray时出错。当前JsonReader项
不是数组:StartObject。路径“”,第1行,位置1。
我可能需要定义要返回的对象,但不确定如何指定以下响应(很抱歉格式化,这里的编辑器删除了缩进):
{"result": [
{
"recordType": "sys_ui_script",
"hits": [],
"tableLabel": "UI Script"
},
{
"recordType": "sys_script",
"hits": [
{
"name": "Approval Events (Non-Task)",
"className": "sys_script",
"tableLabel": "sys_script",
"matches": [ {
"field": "script",
"fieldLabel": "Script",
"lineMatches": [
{
"line": 21,
"context": " updateRecord(current, current.approver.getDisplayValue() + \" rejected the task.\", ",
"escaped": " updateRecord(current, current.approver.getDisplayValue() + " rejected the task.", "
}
],
"count": 2
}],
"sysId": "ad15c8149f4010008f88ed93ee4bcc9f",
"modified": 1489179469000
}
],
"tableLabel": "Business Rule"
}
]}