我有一个JSON字符串,以大括号“{}”开头和结尾。
然后我反序列化对象,但是当这个完成时,我看到我现在在开头和结尾“{{}}”有双花括号。
我的代码看起来像这样
//deserializeobject json string into jobject
JObject loanVersionedDoc = JsonConvert.DeserializeObject<JObject>(s);
//Get the latest value from versioned document
JObject loanLatestVersion = Versioning.demultiplicifyingParseForLatest(loanVersionedDoc);
//TODO get the latest activity.isComplete value
string activityCompletionStatus = (string)loanVersionedDoc.GetValue("Activities[0].isComplete");
这就是我的JSON字符串的样子
"{ \"_id\" : \"582c459d54b6e43d307929f8\", \"LoanName\" :
...
}
这就是我的loanVersionedDoc的样子
{{
"LoanName": "Test One",
"isActive": "True",
"Stages": [
{
"StageName": "Stage One",
"isComplete": false
},
{
"StageName": "Stage Two - CAG Approval and Indicative Terms",
"isComplete": true
},
{
"StageName": "Stage Three",
"isComplete": false
}
],
"Activities": [
{
"ActivityName": "Generate due diligence report",
"isComplete": "Complete",
"ActivityParent": "Stage Two - CAG Approval and Indicative Terms"
},
{
"ActivityName": "Received Stage 2 document from BDM",
"isComplete": "NA",
"ActivityParent": "Stage Two - CAG Approval and Indicative Terms"
},
...
}}
在反序列化时,我必须做什么错误才能使JObject继承一个额外的花括号?