简体   繁体   English

JSON.NET解析错误

[英]JSON.NET parsing error

I've following json string: 我下面的JSON字符串:

{
  "message": "Keine Nachricht mit der Id 55555 gefunden!",
  "exception": {
    "__className": "Exception"
  },
  "request": {
    "__className": "Zend_Controller_Request_Http"
  }
}

JObject.Parse() will throw me this error: JObject.Parse()将抛出此错误:

"Additional text encountered after finished reading JSON content: . Path '', line 1, position 153."

What is wrong this JSON string? 这个JSON字符串怎么了?

It parses fine for me in Ruby. 在Ruby中,这对我来说很好。 The string (when it was one long line) is 152 characters so there may have been a character after that. 字符串(当它是一长行时)是152个字符,因此之后可能还有一个字符。

The following application works: 以下应用程序有效:

class Program
{
    static void Main(string[] args)
    {
        var x =
            @"{""message"": ""Keine Nachricht mit der Id 55555 gefunden!"",""exception"": {""__className"": ""Exception""},""request"": {""__className"": ""Zend_Controller_Request_Http""}}";

        var y = JObject.Parse(x);
    }
}

Check to make sure the string you think you're passing to Parse() indeed looks like the above string. 检查以确保您认为要传递给Parse()的字符串确实看起来像上面的字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM