Create FeatureSet from JSON

1135
1
08-18-2019 09:09 PM
BrianHare
New Contributor

How can I create featureSet from JSON (or IFeatureSet or IEnumerable<Fields>) using version 100 runtime library?

There use to exist `FeatureSet.FromJson` in the 10.x runtime, but that seems to be missing now. I see there is FeatureCollection.FromJson but that doesnt seem to work with JSON from my query.

Here is an example JSON I am wanting to convert into a FeatureSet : https://paste.ee/p/DB9nM 
This is the JSON response from a Roads & Highway ArcGIS Plugin operation QueryAttributeSet -- It was in the correct format to use FeatureSet.FromJson (it would read all the fields, cast them proper and also create geometry objects

How can I get back the FeatureSet.FromJson functionality?  

Tags (3)
0 Kudos
1 Reply
dotMorten_esri
Esri Notable Contributor

The FeatureSet.FromJson had several limitations, mainly due to the fact that a schema was missing (so for instance dates would be returned as longs or ints, some doubles were integers, etc). Features in 100.x have a strict schema requirement, where that just wouldn't work.

The feature collection resolves that by combining the feature service definition and the feature data into one object (and the ability contain multiple tables). There is no equivalent in 100.x, but you should be able to construct a feature-collection-compatible json from the json you already have by adding the extra info around it.

0 Kudos