Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# DropNetRT Dropbox JSON反序列化程序似乎使用了错误的对象类型?_C#_Json.net_Dropbox Api_Dropnet - Fatal编程技术网

C# DropNetRT Dropbox JSON反序列化程序似乎使用了错误的对象类型?

C# DropNetRT Dropbox JSON反序列化程序似乎使用了错误的对象类型?,c#,json.net,dropbox-api,dropnet,C#,Json.net,Dropbox Api,Dropnet,我正在使用DropNetRT尝试与Dropbox集成,但在从Dropbox API反序列化JSON响应时,我始终会遇到错误。不言而喻: 引发的异常是 Newtonsoft.Json.JsonReaderException occurred HResult=-2146233088 Message=Error reading string. Unexpected token: StartObject. Path 'entries[0][1]', line 1, position 202.

我正在使用DropNetRT尝试与Dropbox集成,但在从Dropbox API反序列化JSON响应时,我始终会遇到错误。不言而喻:

引发的异常是

Newtonsoft.Json.JsonReaderException occurred
  HResult=-2146233088
  Message=Error reading string. Unexpected token: StartObject. Path 'entries[0][1]', line 1, position 202.
  Source=Newtonsoft.Json
  LineNumber=1
  LinePosition=202
  Path=entries[0][1]
在var deltaResponse=JsonConvert.DeserializeObjectResponseBy上引发异常

什么是responseBody?为了方便大家,这家伙稍微简化了:

{   
    "has_more": true, 
    "cursor": "BLAGHABLAGAbigDarn-StringTHing123", 
    "entries": 
    [
        ["/exampleFile.pdf", {"revision": 1, "rev": "1131aa664", "thumb_exists": false, "bytes": 249159, "modified": "Mon, 12 Aug 2013 18:55:30 +0000", "client_mtime": "Mon, 12 Aug 2013 18:55:30 +0000", "path": \"/exampleFole.pdf\", "is_dir": false, "icon": "page_white_acrobat", "root": "dropbox", "mime_type": "application/pdf", "size": "243.3 KB"}],
        ["/examplefolder", {"revision": 2, "rev": "2131aa664", "thumb_exists": false, "bytes": 0, "modified": "Tue, 13 Aug 2013 17:30:35 +0000", "path": "/examplefolder", "is_dir": true, "icon": "folder_user", "root": "dropbox", "size": "0 bytes"}]
    ], 
    "reset": true
}
我怀疑是DeltaPageInternal模型造成的,因为条目[0][1]实际上并不是模型所暗示的:

internal class DeltaPageInternal
{
    public string Cursor { get; set; }
    public bool Has_More { get; set; }
    public bool Reset { get; set; }
    public List<List<string>> Entries { get; set; }
}
还有其他人有这个问题吗?考虑到Dropbox的响应类型,它似乎应该非常普遍。。。我是在调用旧的API版本还是什么


像往常一样,提前感谢您提供的任何专业知识

将字符串更改为此,它不是有效的json字符串


ResponseBook字符串是否确实有这样的反斜杠,或者您是否从VisualStudio中的调试器复制了此字符串?如果它有反斜杠,这通常表示它已被双重序列化。@BrianRogers我从调试器复制了它,是否要删除转义符?是的,如果它实际上没有反斜杠,删除它们会使问题更清楚。@BrianRogers谢谢,我现在使用的是移动客户端,但我会在收到后编辑它home@ap我认为你的猜测是正确的。这看起来像DropNetRT中的一个bug。我建议打开一个问题,让库开发人员看看:。问题中的JSON在您提供的工具和Python的JSON解析器中解析得很好。可能是因为问题中的文本是从调试器复制的,因此包含在引号中并转义。首先,我打算在这个问题上使用这个JSON美化工具。省去了我的麻烦
{
    "has_more": true,
    "cursor": "BLAGHABLAGAbigDarn-StringTHing123",
    "entries": [
        [
            "exampleFile.pdf",
            {
                "revision": 1,
                "rev": "1131aa664",
                "thumb_exists": false,
                "bytes": 249159,
                "modified": "Mon, 12 Aug 2013 18:55:30 +0000",
                "client_mtime": "Mon, 12 Aug 2013 18:55:30 +0000",
                "path": "exampleFole.pdf",
                "is_dir": false,
                "icon": "page_white_acrobat",
                "root": "dropbox",
                "mime_type": "applicationpdf",
                "size": "243.3 KB"
            }
        ],
        [
            "examplefolder",
            {
                "revision": 2,
                "rev": "2131aa664",
                "thumb_exists": false,
                "bytes": 0,
                "modified": "Tue, 13 Aug 2013 17:30:35 +0000",
                "path": "examplefolder",
                "is_dir": true,
                "icon": "folder_user",
                "root": "dropbox",
                "size": "0 bytes"
            }
        ]
    ],
    "reset": true
}