I am testing out json.net. I would like to use its linq-to-json syntax to return json from a function attributed [WebMethod] but I am getting errors.
For example if I use in the code behind
[WebMethod, ScriptMethod(UseHttpGet = true)]
public static JObject GetStuff() {
return new JProperty("string", "value");
}
Being called by the following javascript:
PageMethods.GetStuff(/* parameters */, function(data) {
// do stuff with data
});
I get the error "Cannot access child value on Newtonsoft.Json.Linq.JValue".
What should I be returning to ensure that my javascript data object gets filled with JSON?