Serialize 2D arrays