ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / SpatialReferenceBuilder Class / FromJson Method
JSON string representation of a SpatialReference.
Example

In This Topic
    FromJson Method (SpatialReferenceBuilder)
    In This Topic
    Creates a new instance of a SpatialReference class from a JSON string representation.
    Syntax
    public static SpatialReference FromJson( 
       string jsonString
    )
    Public Shared Function FromJson( _
       ByVal jsonString As String _
    ) As SpatialReference

    Parameters

    jsonString
    JSON string representation of a SpatialReference.

    Return Value

    Exceptions
    ExceptionDescription
    The jsonString is empty or null.
    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