Add json helper functions, and remove some old, dead code.