I haven't attempted it myself but I think it's just a matter of assigning different squares to different arrays and saving info into a JSON file.
Each array element has multiple conditions.
[x] can contain ID of square and actual position of a square in a map
[y] can contain info like number of directions possible and id of adjacent squares.
[z] can contain info like items and interact-able elements in the map...