How to get(or serialize) Graphics layer into json format?

4184
2
07-22-2014 12:26 AM
GauriDeshmukh
New Contributor III

I want to get the json response of graphics layer.How do I convert it.

if I use JSON.stringify(graphics_layer); I get an error of "converting circular structure to json".

Is there any other way or option.

0 Kudos
2 Replies
AndyGup
Esri Regular Contributor

What are you trying to do with the JSON? You can loop thru the graphics in a GraphicsLayer and use the Graphic.toJson() method: graphic-amd | API Reference | ArcGIS API for JavaScript

GauriDeshmukh
New Contributor III

hello Andy Gup , I wanted to save the whole json string as it is in database.

Yes finally I did the same. Thanks for ur reply,now m sure that m going in a correct way.

0 Kudos