Fix copying from zk to json, add a test and make it work for Py3