I’m having trouble finding examples for JSONTemplater when working with a JSON array input attribute.
The incoming data looks like this:
{"layers": [
{
"defaultVisibility": true,
"geometryType": "esriGeometryPolygon",
"id": 1,
"maxScale": 0,
"minScale": 0,
"name": "Parcels",
"parentLayerId": -1,
"subLayerIds": null,
"type": "Feature Layer"
}
]}I’m interested in extracting the first array member id value into an object like this:
{"layers": [{"id": 1}]}I can almost get the data into what I want in two steps, first extracting the value with a query json["layers"][0]["id"] and then using the JSONTemplater to use the id value, but bizarrely the value 1 is cast to string “1” byt the templater, which is invalid for downstream work.
Anyone know how to make what I want in one step with JSONTemplater? Thanks.




