How to convert multidimensional array to json and back?

Good day, first time faced with the JSON and a lot of things not clear..
Now, suppose we have a multidimensional array in php:
[0]=>
 array(22) {
["ID"]=>
 string(2) "58"

["NAME"]=>
 string(11) "Tula"
[1]=>
 array(22) {
["ID"]=>
 string(2) "59"

["NAME"]=>
 string(11) "G. Тула1

From a php script and send it back to ajax echo json_encode($array);

And when you do console.log(data), it turns out that came to an object, not an array, but I would like an array...
And, frankly, I do not understand how to access its elements.

[Object]
0
:
Object
ID
:
"58"
NAME
:
"Tula"


var b = $.parseJSON(data);
console.log(b.ID) // gives nothing...
July 8th 19 at 16:48
1 answer
July 8th 19 at 16:50
Solution
You get just an array, inside of which lies a single object: [Object]
Accordingly, it is necessary to do so: console.log(b[0].ID)

Find more questions by tags JavaScriptPHP