Error During Serialization or Deserialization Using the JSON JavaScriptSerializer

When parsing JSON data in your .NET application, you may experience an error that reads, “Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property. Parameter name: input”

The error is shown in the below screenshot.

 

To resolve the error, you need to set the MaxJsonLength property to a higher value than what you are using. Probably, you are using the default value.

To set the value of MaxJsonLength, use the syntax below:

C#

var serializer = new JavaScriptSerializer();
serializer.MaxJsonLength = Int32.MaxValue;

VB

Dim jss = New JavaScriptSerializer()           
jss.MaxJsonLength = Int32.MaxValue

 

How to Auto-Update VB.NET Projects

To auto-update vb.net projects, Click on the project’s menu then select the Project Properties.

Click the Publish tab, then on the Publish Version enter the Major, Minor, Build and Revision Version.

I usually use the  Year, Month and Date as shown below. This ensures that the project gets the next number in the series when published as shown below:

Click the Updates button and make sure the minimum required version for this application is the same as the one you set in the screen above.

 

Now, when publishing the application using the Wizard, specify an FTP URL. This is the location where the application should check for the update before it starts as shown below.

Now, once you publish the application, upload all the installation files in the FTP path that you’ve specified above and clients using your software should now have the new version once they restart their application.