driver-core/src/main/com/mongodb/client/model/geojson/Geometry.java
@SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
    public String toJson() {
        StringWriter stringWriter = new StringWriter();
        JsonWriter writer = new JsonWriter(stringWriter, new JsonWriterSettings());
        Codec codec = getRegistry().get(getClass());
        codec.encode(writer, this, EncoderContext.builder().build());
        return stringWriter.toString();
    }
@SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
    public String toJson() {
        StringWriter stringWriter = new StringWriter();
        JsonWriter writer = new JsonWriter(stringWriter, new JsonWriterSettings());
        Codec codec = getRegistry().get(getClass());
        codec.encode(writer, this, EncoderContext.builder().build());
        return stringWriter.toString();
    }
@ SuppressWarnings ( { "unchecked" , "rawtypes" , "deprecation" } ) public String toJson ( ) { StringWriter stringWriter = new StringWriter ( ) ; JsonWriter writer = new JsonWriter ( stringWriter , new JsonWriterSettings ( ) ) ; Codec codec = getRegistry ( ) . get ( getClass ( ) ) ; codec . encode ( writer , this , EncoderContext . builder ( ) . build ( ) ) ; return stringWriter . toString ( ) ; }
Converts to GeoJSON representation

@return the GeoJSON representation
Converts to GeoJSON representation