无法访问数组内容

My ajax call give me a Json object containing some objects, especially an object 'geometry' with a type and an array. With console.log, it shows me:

Object { type: "Point", coordinates: Array[2] }

Array [ -28.0833333333, -55.9166666667 ]

But when I try to show or to use the content of this array I get an undefined statement.

Here is my ajax call:

$.ajax({ //La requête ajax pour récupérer les données sous forme d'un tableau de Json
                        url: 'includes/query_ajax.php', //adresse du script php qui interroge la BDD
                        data: { terms : terms, database : database, condition : condition,host : host, dbname : dbname, user : user , password : password }, //la requete qu'on lui fait passer en paramètres
                        method: 'post',
                        success: function (data) { //La fonction callback qui sera exécutée une fois que la requête ajax sera terminée
                            //Cette fonction contient la création de la carte et l'affichage des icones tirés de la BDD
                            var iconFeatures=[];
                                var line;
                                var result=$.parseJSON(data); 
                                for (var i=0; i<result.length; i++)//Cette boucle permet de récupérer chaque métadonnée issue de la BDD
                                {   
                                    var line=result[i]//Donne la ieme ligne de métadonnées //$.parseJSON(result[i])//Donne la ieme ligne de métadonnées
                                    coord= line[0]; //On récupère les coordonnées, la hauteur, le nom et le type de volcan etc
                                    ele= line[1];
                                    name=line[2];
                                    status=line[3]
                                    var iconFeature = new ol.Feature({//Création d'un marqueur à partir des données précédentes
                                      geometry: new ol.geom.Point([27, 27]).transform("EPSG:4326", "EPSG:3857"),
                                      name: name ,
                                      elevation: ele,
                                      type: status,
                                      population: 4000,
                                      rainfall: 500
                                    });
                                    iconFeatures.push(iconFeature);//On ajoute ce marqueur à notre tableau de marqueur
                                }

And the php function I use for querying the database just in case:

$bdd = pg_connect("host=".$_POST['host']." dbname=". $_POST['dbname'] ." user=".$_POST['user']." password=".$_POST['password']);//Connexion à la BDD
    if (!$bdd)
    {
        die('Error: Could not connect: ' . pg_last_error());
    }


        $query = "SELECT " . $_POST['terms'] . "FROM " . $_POST['database'];

        $result = pg_query($query) or die('Connexion impossible : '.pg_last_error());//O interroge la BDD
        if (!$result) //Dans le cas ou la requête n'a rien donné, probleme de connexion
        {
            echo "Une erreur s'est produite 
";
            echo pg_last_error();
            exit();
        }
        $res=array();//Initialisation du tableau de résultat

        $fields = explode(',', $_POST['terms']);
        $count= count($fields);
        $j=0;
        while($row = pg_fetch_assoc($result)) {//Boucle de récupération des données, tant qu'il reste des lignes de données
            // $res[$j]=array();
            $temp=array();
            for ($i=0; $i<$count ;$i++)
            {

                if (trim($fields[$i])==trim('ST_AsGeoJSON(position) as geometry'))
                {   
                    $fields[$i]='geometry';
                     $$fields[$i] =json_decode($row['geometry']) -> {'coordinates'};
                }
                else
                {
                    if (is_object(json_decode($row[trim($fields[$i])])))
                    {   
                         $$fields[$i] =json_decode ($row[trim($fields[$i])]);
                    }
                    else
                    {
                        $$fields[$i] =($row[trim($fields[$i])]);
                    }
                }
                $temp[]=$$fields[$i];

            }
            $res[]=$temp;



        }


        echo json_encode($res);//On retourne le résultat sous forme d'un Json


    pg_free_result($result);//On libère le tableau resultat

    pg_close($bdd);//On ferme la connexion

However it returns me a correct Jsonobject so I don't think this is the cause of my issue. I found a way to solve the problem, but this is an overcomplicated method and I really want to know from where comes the problem.

I hope that I've been clear. I'm a beginner in Javascript as you can see, so every suggestion to improve my code we'll be welcome.

Thank you!

EDIT:

Here is the output using console.log(result):

Array [ "[[6.85,50.1666666667],"West Eifel V…", "[{"type":"Point","coordinates":[2.9…", "[{"type":"Point","coordinates":[2.5…", "[{"type":"Point","coordinates":[-4.…", "[{"type":"Point","coordinates":[10.…", "[{"type":"Point","coordinates":[11.…", "[{"type":"Point","coordinates":[12.…", "[{"type":"Point","coordinates":[14.…", "[{"type":"Point","coordinates":[14.…", "[{"type":"Point","coordinates":[14.…", 1535 de plus… ]

I also showed the stringified coord variable to ensure that the array isn't empty:

{"type":"Point","coordinates":[-26.6666666667,-57.0833333333]}

But it doesn't seems to be the case...

EDIT 2:

If I try

console.log(data)

before

var result

It shows:

[[[6.85,50.1666666667],"West Eifel Volc Field","600","Radiocarbon"],[{"type":"Point","coordinates":[2.9666666667,45.775]},"Chaine des Puys","1464","Historical"],[{"type":"Point","coordinates":[2.5333333333,42.1666666667]},"Olot Volc Field","893","Holocene"],[{"type":"Point","coordinates":[-4.0166666667,38.8666666667]},"Calatrava Volc Field","1117","Radiocarbon"],[{"type":"Point","coordinates":[10.8666666667,43.25]},"Larderello","500","Historical"],[{"type":"Point","coordinates":[11.9333333333,42.6]},"Vulsini","800","Historical"],[{"type":"Point","coordinates":[12.7,41.7333333333]},"Alban Hills","949","Holocene?"],[{"type":"Point","coordinates":[14.1388888889,40.8272222222]},"Campi Flegrei","458","Historical"],[{"type":"Point","coordinates":[14.4261111111,40.8213888889]},"Vesuvius","1281","Historical"],[{"type":"Point","coordinates":[14.8333333333,39.4833333333]},"Palinuro","-70","Radiocarbon"],[{"type":"Point","coordinates":[13.8975,40.7333333333]},"Ischia","789","Historical"],[{"type"[…]

in a yellow color.