无法执行jsonconvert.deserializeobject



我的json字符串如下:

"{
    "TotalAmount":{"XPos":"100","YPos":"750"},
    "title":{"XPos":"250","YPos":"800"},
    "ListSetting":{
        "listId":"batchlist",
        "listXPos":"30",
        "listYPos":"700",
        "listCols":"["seq","RemitType"]"
    }
}"

我想将此字符串解析到键字典中,作为totalAmount,title和listSetting,但是在执行DeserializeObject如下时,发生错误。

JsonConvert.DeserializeObject<Dictionary<string, object>>(jsonStr);
An exception of type 'Newtonsoft.Json.JsonReaderException' occurred in Newtonsoft.Json.dll but was not handled in user code    
Additional information: After parsing a value an unexpected character was encountered: s. Path 'ListSetting.listCols', line 1, position 166.

看起来" ListCols"引起了问题,但我不知道如何解决。谁能帮忙?谢谢。

删除 listcols数组周围的引号 ",例如 "listCols":["seq","RemitType"],否则根本不将其视为数组对象,并且显然值得注意会失败

相关内容

  • 没有找到相关文章

最新更新