I am using following code in .cshtml file.
var typeVM = JSON.parse('@Html.Raw(Json.Encode(Model.typeVM))');
Shows following Error:
Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
I dnt get any way to define max length for Json Encode
function and Web.config configuration is only working for web-services.
So question is what is possible solution for this problem?
How do I define jsonMaxLength
property?
I assume it is a web service that you are getting the data from (as your question is tagged "web-service"), change maxlength in web.config :
<configuration>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="50000000"/>
</webServices>
</scripting>
</system.web.extensions>
</configuration>