How to import JSON?

397
1
05-22-2018 12:22 PM
ShawnCastrianni
New Contributor II

In the old ESRI sdk, I could create an AGSFeatureSet by importing a json file.

The json file looked like this:

{"geometryType":"esriGeometryPolygon","features":[{"geometry":{"spatialReference":{"wkid":102100},"rings":[[[-9239517.7358417064,2731827.6590396804],.......

Is this still possible with the new runtime SDK?

0 Kudos
1 Reply
dotMorten_esri
Esri Frequent Contributor

FeatureSet JSON can't stand on it's own, so there's no official JSON spec for this. It needs the Feature Layer definition as well, and that's all part of feature collections, and FeatureCollection does have a FromJson() method you can use. Just note that this is a collection of FeatureLayers where the first part is the Feature Layer definition, and inside it, the FeatureSet itself.