I want certain properties to be serialized as 'objects' and not strings. E.g.
{"onClickHandler": OnClickHandler, "onMouseOut": OnMouseOutHandler}
The class def is like this:
public class handlers {
public string OnClickHandler;
public string OnMouseOutHandler;
}
Currently it comes out as:
handlers: {"onClickHandler": "OnClickHandler", "onMouseOut": "OnMouseOutHandler"}
As you can guess, these are client side event handlers and correspond to javascript functions defined elsewhere. By emitting them within quotes, they are not interpreted as functions but as literal strings.
Edit:
Taking a cue out of Dave's answer, figured out a way:
first a little bit of scrubbing:
for (var handler in this.handlers) {
if(window[this.handlers[handler]])
this.handlers[handler] = window[this.handlers[handler]];
};
and then call jQuery bind normally
$elem.bind(this.handlers);
Accepting Dave's answer as that is closest.