def _json_default_encoder(func):
@wraps(func)<EOL>def inner(self, o):<EOL><INDENT>try:<EOL><INDENT>return o._redpipe_struct_as_dict  <EOL><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>return func(self, o)<EOL><DEDENT>return inner<EOL>
Monkey-Patch the core json encoder library.
This isn't as bad as it sounds.
We override the default method so that if an object
falls through and can't be encoded normally, we see if it is
a Future object and return the result to be encoded.

I set a special attribute on the Struct object so I can tell
that's what it is.

If that doesn't work, I fall back to the earlier behavior.
The nice thing about patching the library this way is that it
won't inerfere with existing code and it can itself be wrapped
by other methods.

So it's very extensible.

:param func: the JSONEncoder.default method.
:return: an object that can be json serialized.