locked
JSON Java Script Serializer. RRS feed

  • Question

  • Hi,

    I got JSON serializer error while processing large number of json data.

    "Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property. at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, StringBuilder output, SerializationFormat serializationFormat) at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, SerializationFormat serializationFormat) "

    How to resolve Above error?

    Thanks

    Wednesday, February 17, 2016 12:52 PM

Answers

  • Just set maxJsonLength of JavaScriptSerializer to a higher value before using it? If you use other classes that calls JavaScriptSerializer for you, you should set it in your Web.config file as stated in the Remark section of my linked documentation.

    • Edited by cheong00Editor Thursday, February 18, 2016 2:22 AM
    • Proposed as answer by Kristin Xie Friday, February 26, 2016 9:52 AM
    • Marked as answer by DotNet Wang Monday, February 29, 2016 5:16 AM
    Thursday, February 18, 2016 2:20 AM
    Answerer