I am testing json.net . I would like to use its linq-to-json syntax to return json from a function attributed to [WebMethod], but I am getting errors.
For example, if I use code
[WebMethod, ScriptMethod(UseHttpGet = true)]
public static JObject GetStuff() {
return new JProperty("string", "value");
}
Called by the following javascript:
PageMethods.GetStuff(, function(data) {
});
I get the error "Unable to access child value in Newtonsoft.Json.Linq.JValue."
What should I return to ensure that my javascript data object is populated with JSON?
source
share