Hi initially my array looked something like this
PHP
$results = array(
    "banana" => $bananavalue,
    "apple" => $applevalue,
);
echo json_encode($results);
JS
var fruits = [];
$.ajax({
  type: "POST",
  url: "actions/MYphp.php",
  data: PassArray,
  dataType: 'json',
  beforeSend: function (html) {
    //    alert(html);
  },
  success: function (html) {
    var obj = html;
    // Now the two will work
    $.each(obj, function (key, value) {
      fruits.push([key, value]);
    });
However I would like to change it to a multidimensional of fruits and vegetable per the below:
results = array(
    "fruit"=>array(
        "banana" => $bananavalue,
        "apple" => $applevalue
    ),
    "vegetables"=>array(
        "lettuce" => $lettuce,
        "cabbage" => $cabbage
    )
);
echo json_encode($results);
The question is how can I loop in each array in Javascript and assign it to two arrays.(fruits and vegetables)
I have tried
$.each(obj['fruit'], function(key, value) {
  fruits.push([key, value]);
});
But that didn't work.