Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rohan 105 posts 162 karma points
    Sep 19, 2014 @ 14:24
    Rohan
    0

    JSON serialization or desecialization error in Umbraco 7.1.6

    Hi

    I have the requirement to use the JSON string for data operation but it's every time giving below error

    Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

    I have followed the steps from below link but getting above error.

    http://24days.in/umbraco/2013/6-easy-configuration-tweaks/

    Can anyone please help as it's really urgent !

    Thanks

    Rohan

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Sep 19, 2014 @ 15:15
    Jeavon Leopold
    1

    Hi Rohan,

    That is the correct way to set the max length for the ASP.NET built in JavaScriptSerializer for web services.

    You might need to set it on your own serializer, e.g.

    var serializer = new JavaScriptSerializer() { MaxJsonLength = 86753090 };
    serializer.Serialize("Your JSON Contents");
    

    Jeavon

  • Comment author was deleted

    Sep 19, 2014 @ 16:57

    Thanks Jeavon for Reply,

    But i got error when calling from Jquery to Controller using ajax Post method.

    please see the below example.

    $.ajax({

                type: 'POST',

                contentType: 'application/json; charset=utf-8',

                url: DataURL,

                dataType: "html",

                data: '{"Image64":"' + Image64 + '"}',

                async: false,

                success: function (data) {

                    debugger;

                    data = data.substring(1, data.length - 1);

                    loadSecondPart(data);

                    $('#imgConfirmOrder').css('display', 'none');

                    //do process.

                },

                error: function (xhr, ajaxOptions, throwError) {

                   alert("Please try later!");

                    return "";

                }

            });

        }

     

    Is there any solution.

     

    Thnaks

    Harshil

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Sep 19, 2014 @ 19:02
    Jeavon Leopold
    0

    Hi Harshil,

    Is this the same issue as Rohan?

    What are you posting to and what is Image64?

    Jeavon

Please Sign in or register to post replies

Write your reply to:

Draft