Save internal state to json for later unit testing