I'm trying to call a WebMethod via ajax with a JSON string as follows:
                let jsonData = JSON.stringify({test: "Test"});
                $.ajax({
                    type: "POST",
                    url: "WebForm.aspx/DoStuff",
                    data: '{data: "' + jsonData + '" }',
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: OnSuccess,
                    failure: function (response) {
                        alert(response.d);
                    }
                });
However, I get a HTTP 500 internal error.
I would like to parse the JSON string in the WebMethod as I do not know the values at runtime. The WebMethod looks like this:
        [WebMethod]
        public static string DoStuff(string data)
        {
            var keyValuePairs = JsonConvert.DeserializeObject<Dictionary<string, string>>(data);
            foreach (var key in keyValuePairs.Keys)
            {
                ...
            }
            return ...
        }
