JSON compression mostly done

Please could you test it more thoroughly, I've not been able to.