I use this code:
JsonTextParser pars = new JsonTextParser();
JsonObject obj = pars.Parse(XXX);
When the XXX equals to:
{
"responseData":
{
"results":[],"cursor":
{
"moreResultsUrl":"http://www.google.com/search?oe\u003dutf8\u0026ie\u003dutf8\u0026source\u003duds\u0026start\u003d0\u0026hl\u003den\u0026q\u003d%D7%90%D7%97%D7%9C%D7%94+%D7%91%D7%97%D7%9C%D7%94+%D7%91%D7%92%D7%A8%D7%A0%D7%93+%D7%A7%D7%99%D7%99%D7%9E%D7%9F"
}
},
"responseDetails": null, "responseStatus": 200
} And the exception is:
System.FormatException was unhandled by user code
Message="Cannot parse a value."
Source="System.Net.Json"
StackTrace:
at System.Net.Json.JsonTextParser.ParseSomethingWithoutName()
at System.Net.Json.JsonTextParser.ParseCollection()
at System.Net.Json.JsonTextParser.ParseSomethingWithoutName()
at System.Net.Json.JsonTextParser.ParseCollection()
at System.Net.Json.JsonTextParser.ParseSomethingWithoutName()
at System.Net.Json.JsonTextParser.ParseCollection()
at System.Net.Json.JsonTextParser.ParseSomethingWithoutName()
at System.Net.Json.JsonTextParser.Parse(String text)
at Default8.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\eViL\My Documents\Visual Studio 2008\WebSites\NewTest\Default8.aspx.cs:line 20
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
I'm no expert in json but its seems like a valid json format. And I maybe think its that null, but then it would throw different exception, right?