Changed JSON generator to support more robust caching and chunking.