I think your problem might be that the map doesn't actually contain the ds_grid - it just contains its index.
So if you'll load it after the ds_grids no longer exists - if you restarted the game, for example - the value that was supposed to contain a ds_grid will just be a meaningless index.
The method I can think of to solve this, and there very well may be better ways, is to store each ds_grid as a ds_list of ds_lists, adding them to the map using ds_map_add_list, and then saving the map using JSON.
You'll also need to use ds_list_mark_as_list for the ds_lists within the ds_lists representing the ds_grids.
Then, if necessary, you can add functionality when you load them to turn the ds_lists back to ds_grids.
Edit: Okay, What stainedofmind is suggesting is better. Convert each ds_grid to a string using ds_grid_write and add those strings to the ds_map, not the indexes.