add json encoder and deconder.