The `for_json` hook is nice, but doesn't work for subclasses of builtin
types. This fork moves the for_json check earier, allowing all custom
objects to work.