Added dump_json() and get_json() methods.

This functionality can now be easily overridden by subclasses.