Conversion Class

Conversion class provides a set of static methods to convert a JSON string into an ESRI object.


Methods

NameDescription
Conversion.ToGeometry(String, esriGeometryType)Converts a JSON string into an ArcObjects geometry.
Conversion.ToGeometry(JsonObject, esriGeometryType)Converts a JsonObject into an ArcObjects geometry.
Conversion.ToSpatialReference(String)Converts a JSON string into an ArcObjects spatial reference.
Conversion.ToJson(IGeometry)Converts an ArcObjects geometry to a JSON UTF-8 string as an array of bytes.
Conversion.ToJson(IGeometry, Boolean)Converts an ArcObjects geometry to a JSON UTF-8 string as an array of bytes.
Conversion.ToJson(IRecordSet)Converts an ArcObjects RecordSet to a JSON UTF-8 string as an array of bytes.
Conversion.ToJsonObject(IGeometry)Converts an ArcObjects geometry to a JsonObject.
Conversion.ToJsonObject(IGeometry, Boolean)Converts an ArcObjects geometry to a JsonObject.

Conversion.ToGeometry(String, esriGeometryType) Method

Converts a JSON string into an ArcObjects geometry. This method returns null if the conversion can't be performed.

Use dark colors for code blocksCopy
1
public static IGeometry ToGeometry(string json, esriGeometryType geometryType)
Parameter nameDescription
jsonThe input JSON string.
geometryTypeesriGeometryType

Conversion.ToGeometry(JsonObject, esriGeometryType) Method

Converts a JsonObject into an ArcObjects geometry. This method returns null if the conversion can't be performed.

Use dark colors for code blocksCopy
1
public static IGeometry ToGeometry(JsonObject jsonGeometry, esriGeometryType geometryType)
Parameter nameTypeDescription
jsonGeometryJsonObjectThe JsonObject to convert.
geometryTypeesriGeometryTypeThe type of geometry to convert to.

Conversion.ToSpatialReference(String) Method

Converts a JSON string into an ArcObjects spatial reference.

Use dark colors for code blocksCopy
1
public static ISpatialReference ToSpatialReference(string json)
Parameter nameTypeDescription
jsonstringThe input JSON string for the spatial reference.

Conversion.ToJson(IGeometry) Method

Converts an ArcObjects geometry to a JSON UTF-8 string as an array of bytes.

Use dark colors for code blocksCopy
1
public static byte[] ToJson(IGeometry geometry)
Parameter nameTypeDescription
geometryIGeometryThe ArcObjects geometry to convert to JSON.

Conversion.ToJson(IGeometry, Boolean) Method

Converts an ArcObjects geometry to a JSON UTF-8 string as an array of bytes.

Use dark colors for code blocksCopy
1
public static byte[] ToJson(IGeometry geometry, bool writeSpRef)
Parameter nameTypeDescription
geometryIGeometryThe ArcObjects geometry to convert to JSON.
writeSpRefboolSet to true to include spatial reference.

Conversion.ToJson(IRecordSet) Method

Converts an ArcObjects RecordSet to a JSON UTF-8 string as an array of bytes. The geometries in each record will be generalized and densified, before they are serialized to JSON.

Use dark colors for code blocksCopy
1
public static byte[] ToJson(IRecordSet recordset)
Parameter nameTypeDescription
recordsetIRecordSetThe RecordSet to convert.

Conversion.ToJsonObject(IGeometry) Method

Converts an ArcObjects geometry to a JsonObject.

Use dark colors for code blocksCopy
1
public static JsonObject ToJsonObject(IGeometry geometry)
Parameter nameTypeDescription
geometryIGeometryThe ArcObjects geometry to convert.

Conversion.ToJsonObject(IGeometry, Boolean) Method

Converts an ArcObjects geometry to a JsonObject.

Use dark colors for code blocksCopy
1
public static JsonObject ToJsonObject(IGeometry geometry, bool writeSpRef)
Parameter nameTypeDescription
geometryIGeometryThe ArcObjects geometry to convert.
writeSpRefboolSet to true to include spatial reference.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.