This question already has an answer here:
var webMapAsJSON = map.toWebMap();
From the "Export Web Map Task" documentation in the REST API, there's this line that suggests it should exist:
However, I don't see anything in the Map object or elsewhere in the API that would do this. Any ideas?