When using the example JSON string for featureCollection (https://developers.arcgis.com/web-map-specification/objects/featureCollection/#example), I am able to see FeatureCollection.fromJson work properly. This example string doesn't include the layers array. When I add my own hardcoded layers array to this example JSON string it doesn't appear to work (not listed when calling FeatureCollection.toJson). Any ideas on how to fix this? Here is the example JSON string that I am trying:
{
"showLegend": false,
"groupIdField": "GROUPID",
"groups": [
{
"groupId": 1,
"groupType": "pointSymbolCallout"
}
],
"layers": [
{
"nextObjectId": 1,
"showLegend": true,
"popupInfo": {},
"layerDefinition": {},
"featureSet": {
"features": [],
"geometryType": "esriGeometryEnvelope"
}
}
]
}