Mission editor map save

I am thinking about making map editor to my game, but i would like it to be saved as file, so it could be sent to someone etc. I don’t know how to do that. Let’s say that editor would be grid based and would have 2 layers:
-Terrain layer (ground, walls, slopes, stairs, pitfalls etc.)
-Object layer (lamps, trees etc.)

So let’s say map would be 100x100 tiles. I would create two dimensional array of Integer for each layer.
Every index would have index of used terrain/object as value, for example:

terrainLayer[5,12] = 7;

At map file load, game would just check those arrays and insantiate objects.
The problem is how to save these arrays to savefile so it could be sent to someone. Any tips?

I made a small sample project that lets you save and load data from your scene, including GameObjects. Here is the link:

SerializeHelper - Free save and load utility. (De)Serialize all objects in your scene.

If you decide to use it, then I suggest that saving the array data directly in a variable of the SaveGame class instance.

Note thet multi-dimensional arrays can’t be serialized; They have to be flattened first, and you have to un-flatten it after deserializing it. Flattening is easy, you just arrange the rows one after another (so 2D array [rows,columns] is made into [rows*columns]. To unflatten, you have to save thh row length alongside it so you know where to start a new row when going through the flat array after loading it.