Epic rewrite of JSON implementation.