On a postback the ajax call to a WCF webservice uses postData but the JSON.stringify fails on mainly IE though works fine in Chrome and FireFox

I have a Dynatree and onSelect: function(select, node), I call a routine SaveUserTree()`.

In this routine, I get the latest toDict() on the tree which then is passed to a JSON stringify function. The resultant postData is then sent to the WCF service call. However, the JSON.stringify fails on IE but works in both Chrome and FireFox. The error is 'undefined' and some other info using F12 debugger reveals:

JSON is undefined number -2146823279 name "TypeError"

function SaveUserTree(treeNode){
    var dict = $("#tree").dynatree("getTree").toDict();

    postData = JSON.stringify(dict);

        type: "POST",
        url: "TodoTreeService.svc/SaveTree/New?Name=" + $("#hdnUserFile").val(),
        //contentType: "application/json; charset=utf-8",
        dataType: "json",
        data: postData, 
        success: function (arg){
            alert("SUCCESS - " + JSON.stringify(arg));                   
        error: function (xhr, ajaxOptions, thrownError) {
            alert("ERROR - " + JSON.stringify(xhr.responseText));


Please help as this is a biggie.


This will be surely because you are using older version of IE which does not support JSON. So use the json2.js fallback by Douglas Crockford json3.js fallback. Just refer the library in your page like this

<script type='text/javascript' 

Need Your Help

How to notify user when he entered into a Movie theater in android?

android google-maps geofencing

In my android app i ve map view and current location,nearest theaters displayed now i want to notify user when he entered into a theater(like geofence) i searched on NET and dint find any Android ...