An overview of the JSON toolset

The JSON toolset contains tools to convert features to JSON and JSON to features based on ArcGIS REST API specification for featureset. JavaScript Object Notation (JSON) is a text-based, lightweight, data interchange format to share GIS data between ArcGIS and other systems. It is language-agnostic and most programming languages such as Python, C#, Java, JavaScript, and so on, provide libraries to read, manipulate, and write JSON.

Featureset JSON

ArcGIS REST API specification defines featureset as a collection of features with a specific geometry type, fields, and a spatial reference. The JSON format of featureset is shown below. The geometryType, spatialReference, and Fields properties define the geometry type, spatial reference, and field definitions for the collection of features. The features property defines the collection of features. Each feature in the collection has a geometry and field values (known as attributes) . The hasZ and hasM property specifies whether the features geometry have Z and M values.

JSON representation of Featureset

{ 
"displayFieldName" : "<displayFieldName>",
"fieldAliases" : {
  "<fieldName1>" : "<fieldAlias1>",
  "<fieldName2>" : "<fieldAlias2>"
},
"geometryType" : "<geometryType>",
"hasZ" : <true|false>,  //Added at 10.1
"hasM" : <true|false>,   //Added at 10.1
"spatialReference" : <spatialReference>,
"fields": [
            {
                "name": "<field1>",
                "type": "<field1Type>",
                "alias": "<field1Alias>"
            },
            {
                "name": "<field2>",
                "type": "<field2Type>",
                "alias": "<field2Alias>"
            }
        ],
 "features": [
            {
                "geometry": {
                    <geometry1>
                },
                "attributes": {
                    "<field1>": <value11>,
                    "<field2>": <value12> 
                } 
            },
            {
                "geometry": {
                    <geometry2>
                },
                "attributes": {
                    "<field1>": <value21>,
                    "<field2>": <value22> 
                } 
            }
        ]
}

Tools

Features TO JSON

Converts features to JSON format. The fields, geometry, and spatial reference of features will be converted to their corresponding JSON representation and written to a file with a .json extension.

JSON To Features

Converts JSON features based on ArcGIS REST API specification into a feature class. The feature class will have fields, geometry type, and spatial reference as defined in the JSON.

Related Topics

3/3/2014