By utilizing this function, I am able to fetch a JSON list:
$(document).ready(function () {
var idContact = @ViewData["IdPhysique"];
var Url = "/Accueil/DonneListeFonctionContact";
$.getJSON(Url, { IdContact: idContact }, function (data) {
});
});
The obtained JSON data is as follows:
Now, my goal is to convert that JSON into an array, so I attempted the following:
$(document).ready(function () {
var idContact = @ViewData["IdPhysique"];
var Url = "/Accueil/DonneListeFonctionContact";
var jsonData = $.getJSON(Url, { IdContact: idContact }, function (data) {
});
var jsonArray = JSON.parse(jsonData);
});
Unfortunately, an error is being displayed in the Google development tool:
Uncaught SyntaxError: Unexpected token o
Are there any alternative methods to achieve the desired outcome?