ESRI Graphic has "toJson()" method, but Feature Layer has not such a methos. How do I save a feature layer into json text file?
Solved! Go to Solution.
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
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
@ReneRubalcava ,
I used the query to get a FeatureSet, and succeeded to save the feature layer to text and also to recreate it from that text.
Thank you very much!