How to save 2D arrays to text files and load 2D arrays from text files.

I’ve now got an idea on how to make my Tile editor but I dont know how to save the map data to a file and then read them from the file. Any ideas? (Maps are 2D arrays)