JSON-encode WSME types properly

Ordinarily, WSME handles calling its `tojson` method, which converts type instances into dictionaries.  However, this means that just calling `json.dumps` on such an object fails, which is inconvenient in tests and in passing JSON-ified data around through other means.

This patch adds the capability to encode such objects to Flask's JSON support, meaning that `flask.jsonify` and `flask.json.dumps` will both correctly interpret type instances.