JSON To Features (Conversion)

Summary

Converts feature collections in an Esri JSON (.json) file or GeoJSON (.geojson) file to a feature class.

Usage

  • If the input JSON file has the hasZ or hasM property set to True, the output features will have z- and m-values.

  • If the input is a GeoJSON file, you must select the geometry type to convert to a feature class. GeoJSON supports multiple feature types within the same file, and a feature class must be composed of features of the same feature type.

Parameters

LabelExplanationData Type
Input JSON or GeoJSON

The input JSON or GeoJSON file to convert to a feature class.

The input file extension determines the conversion routine used by the tool. Esri JSON formatted files must use the .json extension, and GeoJSON files must use the .geojson extension for proper conversion to occur.

File
Output Feature Class

The output feature class created to contain the features converted from the input JSON or GeoJSON file.

Feature Class
Geometry Type
(Optional)

The geometry type to convert from GeoJSON to features. This option is only used when the input is a GeoJSON file. If the GeoJSON file does not contain any of the selected geometry type, the output feature class will be empty.

  • PointConvert any points to features.
  • MultipointConvert any multipoints to features.
  • PolylineConvert any polylines to features.
  • PolygonConvert any polygons to features.
String

arcpy.conversion.JSONToFeatures(in_json_file, out_features, {geometry_type})
NameExplanationData Type
in_json_file

The input JSON or GeoJSON file to convert to a feature class.

The input file extension determines the conversion routine used by the tool. Esri JSON formatted files must use the .json extension, and GeoJSON files must use the .geojson extension for proper conversion to occur.

File
out_features

The output feature class created to contain the features converted from the input JSON or GeoJSON file.

Feature Class
geometry_type
(Optional)

The geometry type to convert from GeoJSON to features. This option is only used when the input is a GeoJSON file. If the GeoJSON file does not contain any of the selected geometry type, the output feature class will be empty.

  • POINTConvert any points to features.
  • MULTIPOINTConvert any multipoints to features.
  • POLYLINEConvert any polylines to features.
  • POLYGONConvert any polygons to features.
String

Code sample

JSONToFeatures example (Python window)

The following Python script demonstrates how to use the JSONToFeatures function.

import arcpy
import os
arcpy.env.workspace = "c:/data"
arcpy.JSONToFeatures_conversion("myjsonfeatures.json", os.path.join("outgdb.gdb", "myfeatures"))

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics