Skip to main content
Solved

JSONUpdater: Delete

  • September 20, 2019
  • 1 reply
  • 64 views

nielsgerrits
VIP
Forum|alt.badge.img+60

Background: I try to update the attributes of features in an ArcGIS Server Feature Service via the REST endpoint. (ApplyEdits) In an attempt to create a generic solution, I write my features to an Esri-JSON, then read the result back in as a text file and use the JSONUpdater and the JSONTemplater to create the JSON ArcGIS Server understands. My goal is to produce the following JSON:

[{
    "id": 0,
    "updates": [{
        "attributes": {
            "objectid": 1,
            "attribute1": "a"
        }
    }, {
        "attributes": {
            "objectid": 2,
            "attribute1": "b"
        }
    }]
}]

My Esri-JSON is:

{
    "RecordSet" : {
        "geometryType" : "esriGeometryPoint",
        "spatialReference" : {
            "wkid" : ""
        },
        "features" : [
            {
                "geometry" : {
                    "x" : 0,
                    "y" : 0
                },
                "attributes" : {
                    "objectid" : 1,
                    "attribute1" : "a"
                }
            },
            {
                "geometry" : {
                    "x" : 0,
                    "y" : 0
                },
                "attributes" : {
                    "objectid" : 2,
                    "attribute1" : "b"
                }
            }
        ]
    }
}

Now I want to delete "geometry" as I only want to update the attributes. (I think to understand geometry is an Object, correct?) I think the correct path to geometry is:

json["RecordSet"]["features"][*]["geometry"]

But I do not understand how I get the syntax right to let the JSONUpdater delete it...

Can anyone point me in the right direction?

Added workspace:

Best answer by nielsgerrits

Turned out I did change the object "features" to "updates", but did not change the path as well...

The correct syntax is:

  • Update Type
    • Delete From Object
  • JSON Path
    • json["RecordSet"]["updates"][*]
  • Object/Array Index
    • geometry

Happy I at least understood how it should work.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

nielsgerrits
VIP
Forum|alt.badge.img+60
  • Author
  • 2939 replies
  • Best Answer
  • September 20, 2019

Turned out I did change the object "features" to "updates", but did not change the path as well...

The correct syntax is:

  • Update Type
    • Delete From Object
  • JSON Path
    • json["RecordSet"]["updates"][*]
  • Object/Array Index
    • geometry

Happy I at least understood how it should work.