Polygon object not drawing
I'm trying to create an esri.geometry.Polygon using a JSON object as per the Javascript API reference. I'm creating the JSON object, and then referencing it in the creation of the polygon, just like in the API reference. I've copied the syntax exactly yet my polygon fails to draw.
My code is:
this is the polygon:
console.log(hullString);
{"rings": [[[-73.7104093,40.54816076],[-73.7519722,40.5871111],[-73.7601326,40.61371559],[-73.7615556,40.8149722],[-73.7562433,40.8320452],[-73.7265199,40.86482226],[-73.6309606,40.8962101],[-73.5906812,40.90843197],[-73.5679025,40.91454289],[-73.3965069,40.9539866],[-71.9822949,41.2742658],[-71.85812147,41.07093545],[-71.85784367,41.0701021],[-71.8675662,41.0606577],[-71.8772889,41.05565774],[-71.91034587,41.04371326],[-72.044796,40.99537948],[-72.39814118,40.8689892],[-72.4800884,40.8420448],[-72.5287016,40.8267668],[-73.0403879,40.6720437],[-73.04316579,40.67121038],[-73.0576108,40.66732155],[-73.1362248,40.6473219],[-73.20219949,40.6340722],[-73.7104093,40.54816076],[-73.7104093,40.54816076]]],"spatialReference": {"wkid": 102100} }
this is where I create the polygon:
var polygon = esri.geometry.geographicToWebMercator(new esri.geometry.Polygon(hullString));
But the polygon is empty:
console.log(polygon);
Object { type="polygon", rings=[0], _ring=0, more...}
But if I copy the JSON string from the console, and paste that into:
var polygon = esri.geometry.geographicToWebMercator(new esri.geometry.Polygon(paste above JSON here));
the polygon draws fine in my map.
This should be simple, I'm sure I'm overlooking something.