Conversion class provides a set of static methods to convert a JSON string into an ESRI object.
Methods
| Name | Description | 
|---|---|
| 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.
public static IGeometry ToGeometry(string json, esriGeometryType geometryType)| Parameter name | Description | 
|---|---|
| json | The input JSON string. | 
| geometryType | esriGeometryType | 
Conversion.ToGeometry(JsonObject, esriGeometryType) Method
Converts a JsonObject into an ArcObjects geometry. This method returns null if the conversion can't be performed.
public static IGeometry ToGeometry(JsonObject jsonGeometry, esriGeometryType geometryType)| Parameter name | Type | Description | 
|---|---|---|
| jsonGeometry | JsonObject | The JsonObject to convert. | 
| geometryType | esriGeometryType | The type of geometry to convert to. | 
Conversion.ToSpatialReference(String) Method
Converts a JSON string into an ArcObjects spatial reference.
public static ISpatialReference ToSpatialReference(string json)| Parameter name | Type | Description | 
|---|---|---|
| json | string | The 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.
public static byte[] ToJson(IGeometry geometry)| Parameter name | Type | Description | 
|---|---|---|
| geometry | IGeometry | The 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.
public static byte[] ToJson(IGeometry geometry, bool writeSpRef)| Parameter name | Type | Description | 
|---|---|---|
| geometry | IGeometry | The ArcObjects geometry to convert to JSON. | 
| writeSpRef | bool | Set 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.
public static byte[] ToJson(IRecordSet recordset)| Parameter name | Type | Description | 
|---|---|---|
| recordset | IRecordSet | The RecordSet to convert. | 
Conversion.ToJsonObject(IGeometry) Method
Converts an ArcObjects geometry to a JsonObject.
public static JsonObject ToJsonObject(IGeometry geometry)| Parameter name | Type | Description | 
|---|---|---|
| geometry | IGeometry | The ArcObjects geometry to convert. | 
Conversion.ToJsonObject(IGeometry, Boolean) Method
Converts an ArcObjects geometry to a JsonObject.
public static JsonObject ToJsonObject(IGeometry geometry, bool writeSpRef)| Parameter name | Type | Description | 
|---|---|---|
| geometry | IGeometry | The ArcObjects geometry to convert. | 
| writeSpRef | bool | Set to true to include spatial reference. |