implement Json codec (to be continued)