how to save featurelayer into json by javascript in web app?

155
1
08-03-2021 04:05 AM
MichaelLev
Occasional Contributor III

ESRI Graphic has "toJson()" method, but Feature Layer has not such a methos. How do I save a feature layer into json text file?

Tags (2)
0 Kudos
1 Reply
ReneRubalcava
Frequent Contributor

You can query the features you're interested in, iterate them and run .toJSON() on each feature. There's no quick way to export all features to JSON though, due to stuff like server query limits. 

 

Oh and FeatureLayer queries return a FeatureSet, and that has a toJSON() method on it too. https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-FeatureSet.html

0 Kudos