Rework toJSON to be conformant with JSON package.

We had methods named toJSON that were async. This interferred with
the workings of JSON.stringify. In the course of fixing this problem
it became clear that we could remove a significant amount of code
that essentially duplicated portions of JSON.stringify.