Best Way to save Array 2d in JSON format

I want to save the depth and position. How to save 2d array into JSON format with parameter

public GameObject Ship;
    public GameObject hole;
    public GameObject turtle;
    public GameObject panelhole;
    public GameObject panelturtle;
    public static bool captureAllKeyboardInput = false;

    private bool paneloff = false;
    public float duration =1;

    public int[,] grid = new int[12, 12];
    public float[,] depth = new float[3, 3]
                            {{1.6f, 2.3f, 3.5f },
                             {4, 5, 6.5f},
                             {7, 8, 6.5f}};
    int row, column, num1, num2;
    int p1;
    int p2;

    int[] grid2 = new int[5];
    public Text shiposition = null;
   
    //direction = Ship.transform.rotation.z;
    float LastMove;
    float timeIn = 0.5f;
    public Vector3 direction;

    float zvalue;

private void position(int[,] grid)
    {

        for (int i = 0; i < grid.GetLength(0); i++)
        {
            for (int j = 0; j < grid.GetLength(1); j++)
            {
                if (grid[i, j] == 1)
                {
                    Debug.Log("x: " + i + " y: " + j + " Grid: " + grid[i, j]);
                   
                    shiposition.text = "X : " + i + " " + "Y : " + j;
                    
                }

            }
        }
    }


    [SerializeField]
    public void depthsea(float[,] depth)
    {
        for (int x = 0; x < depth.GetLength(0); x++)
        {
            for (int y = 0; y < depth.GetLength(1); y++)
            {
                if (grid[x, y] == 1)
                {

                    myclass.depthtext.text = "Depth :" + depth[x, y];
                }
       
            }
        }
    }

You can just build the .JSON data your self as a string then save the string.

    using System.IO;
    string jsonData;
    private void CreateJson(int[,] grid)
    {
        for (int i = 0; i < grid.GetLength(0); i++)
        {
            for (int j = 0; j < grid.GetLength(1); j++)
            {
                if (grid[i, j] == 1)
                {
                    Debug.Log("x: " + i + " y: " + j + " Grid: " + grid[i, j]);
                    //format the json data here
                    jsonData += "X : " + i + ",

";
jsonData += "Y : " + j + "
";
}
}
}
//save the JSON data or do something with it
//…
File.WriteAllText(“c:\file.json”, jsonData);
}