I\'m tearing my hair out over this one, so bear with me (it\'s a long post).
Have you looked at JSON.NET? I was using it to convert objects in c# to JSON friendly strings then passing it back across the wire to my client where I parsed it into a JSON object. In the end I got rid of it and went to JSON2 for stringify. Here is my ajax call I use:
function callScriptMethod(url, jsonObject, callback, async) {
callback = callback || function () { };
async = (async == null || async);
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
url: url,
data: JSON.stringify(jsonObject),
dataType: 'json',
async: async,
success: function (jsonResult) {
if ('d' in jsonResult)
callback(jsonResult.d);
else
callback(jsonResult);
},
error: function () {
alert("Error calling '" + url + "' " + JSON.stringify(jsonObject));
callback([]);
}
});
}