Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I override maxstringlength for JSON.NET deserialization
    text
    copied!<p>When trying to deserialize my data I get the following exception:</p> <blockquote> <p>{"Message":"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.\r\nParameter name: input","StackTrace":" at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)\r\n at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"}</p> </blockquote> <p>Here is the code:</p> <pre><code>Public Function Nominate(ByVal nominationRequest As String, ByVal nominee As String, ByVal coordinator As String) As Result Dim status As String = "ok" Dim messages As New List(Of String) Try Dim jsonSettings As JsonSerializerSettings = New JsonSerializerSettings() jsonSettings.NullValueHandling = NullValueHandling.Ignore jsonSettings.DefaultValueHandling = DefaultValueHandling.Ignore 'jsonSettings. Dim jNomination As NominationRequest = JsonConvert.DeserializeObject(nominationRequest, GetType(NominationRequest), jsonSettings) Dim jNominee As Nominee = JsonConvert.DeserializeObject(nominee, GetType(Nominee), jsonSettings) Dim jCoord As Nominee = JsonConvert.DeserializeObject(coordinator, GetType(Nominee), jsonSettings) messages.AddRange(SaveNomination(jNomination, jNominee, jCoord)) Catch ex As Exception status = "error" messages.Add(ex.ToString()) ExceptionManagement.ExceptionManager.Publish(ex) End Try Dim result As Result = New Result() result.Status = status result.Messages = messages Return result End Function </code></pre> <p>I just want it to work with the giant strings I'm getting as parameters. I was originally using version 4.5.14811 and have updated to version 5.08.16617 in hopes that it would resolve my issue (despite the changelogs not giving me too much hope). I am using the .NET 3.5 version of the DLL. Please let me know if you need any more information to help me out on this.</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload