encode struct/interface