Add encode method for multidimensional data sending