redo json output

This simplifies the json output considerably, and makes numerous corrections to it.