2012-08-29 363 views
1

我下面的JSON字符串:JSON.NET解析错误

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

JObject.Parse()将抛出我这个错误:

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

什么是错的这个JSON字符串?

+0

json字符串末尾是否有空格或字符? – Erwin

+2

没有......... –

+0

最后有控制字符。对不起是我的错误。 –

回答

0

它在Ruby中解析我。该字符串(当它是一个长行)是152个字符,所以之后可能有一个字符。

0

下面的应用程序的工作原理:

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); 
    } 
} 

检查以确保字符串你认为你传递给解析()确实看起来像上面的字符串。