Failing to serialize 2D arrays [Elasticsearch.NET]

A simple 2D array (aka multi-dimensional array) for a linestring such as this fails to serialize into json:

new[,]
{
    { 10.0, 10.0 },
    {15.0, 15.0 }
}

With the exception message

Elastic.Transport.UnexpectedTransportException: 'Serialization and deserialization of 'System.Double[,]' instances is not supported. Path: $.Coordinates.'

This seems odd that geojson support has disappeared all of a sudden, as that was a main reason for choosing this DB many years ago. Not everyone uses Elasticsearch just for storing logs.

Reading up on the issue this seems to be because System.Text.Json is now being used, and that doesn't support 2d arrays according to Microsoft documentation, so we effectively lost functionality.

What is now a good way of proceeding to use v 8.13 of the dotnet client for geojson data?


Full Program.cs as a demo of the issue

using Elastic.Clients.Elasticsearch;
using Elastic.Transport;

namespace Testing
{
    internal class Program
    {
        static async Task Main(string[] args)
        {
            var settings = new ElasticsearchClientSettings(new Uri("http://localhost:9200"))
                .Authentication(new BasicAuthentication("elastic", "Too4Strong"));

            var client = new ElasticsearchClient(settings);

            var line = new Line
            {
                Type = "LineString",
                Coordinates = new[,]
                {
                    { 10.0, 10.0 },
                    {15.0, 15.0 }
                }
            };

            await client.Indices.CreateAsync("testing");
            var result = await client.IndexAsync(line, (IndexName)"testing");
        }
    }

    public record Line
    {
        public required string Type { get; set; }
        public required double[,] Coordinates { get; set; }
    }
}

I believe I've found the solution to this question.
The trick is to create a converter for the data type ourselves and then register that converter. I hope Microsoft resolves this on their side in the future.

The converter itself worked straight off the bat from this StackOverflow answer c# - How can I serialize a double[,] 2d array to JSON using System.Text.Json? - Stack Overflow

On my API I can't pass in options every time the JSON arrives at the controller so I registered it in startup.cs, it's also a lot cleaner.

services
    .AddControllers()
    .AddJsonOptions(options => options.JsonSerializerOptions.Converters.Add(new Array2DConverter()));

Now I'm able to entirely use system.text.json without mixing in Newtonsoft.