mhoover12

esri.Graphic(json)

Discussion created by mhoover12 on Jan 14, 2011
This constructor has got me beat.  Here is an example json string.  To obtain this string, I called toJson() on a graphic, then used Ext.util.JSON.encode() to be able to save and later retrieve it from a database.  Problem is, once I've retrieved it, the constructor esri.Graphic(json) fails to load up the geometry/symbol properties from this json string.  Can anyone assist?

"{"geometry":{"rings":[[[-12440279.227465763,4451692.527327511],[-12440279.227465763,4451692.527327511],[-12440279.227465763,4451692.527327511]]],"spatialReference":{"wkid":102100}},"symbol":{"color":[51,153,102,64],"outline":{"color":[0,0,0,255],"width":1.5,"type":"esriSLS","style":"esriSLSDashDot"},"type":"esriSFS","style":"esriSFSSolid"}}"

Edit: Well that was easy.  Just had to decode it using Ext.util.JSON.decode() and pass the resulting object to the constructor.

Outcomes