Implement dirty checking for cached JSON

Downsides of caching discussed in previous commit no longer apply.