ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / SpatialReference Class / ToJson Method
Example

In This Topic
    ToJson Method (SpatialReference)
    In This Topic
    Converts this spatial reference instance into an ArcGIS JSON spatial reference representation.
    Syntax
    public string ToJson()
    Public Function ToJson() As String

    Return Value

    Spatial reference represented as a JSON string.
    Example
    Import and Export Spatial Reference
    SpatialReference srWithVertical = SpatialReferenceBuilder.CreateSpatialReference(4326, 6916);
    
    string xml = srWithVertical.ToXml();
    SpatialReference importedSR = SpatialReferenceBuilder.FromXml(xml);
    // importedSR.Wkid = 4326
    // importedSR.VcsWkid = 6916
    
    string json = srWithVertical.ToJson();
    importedSR = SpatialReferenceBuilder.FromJson(json);
    // importedSR.Wkid = 4326
    // importedSR.VcsWkid = 6916
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also