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.

Syntax

JSONToFeatures(in_json_file, out_features, {geometry_type})
ParameterExplanationData Type
in_json_file

The JSON file (.json) to convert.

File
out_features

The output feature class to create.

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