Converting JSON to select list options I have an array that I have JSON decoded from a JSON object. Below is my array I am using for select options. The problem is each select options has a option group with a number (0-11). How can I convert this array to one that does not have these numbers in front of it?

Here is my array:

    array(21) { [0]=&gt; array(1) { [198413]=&gt; string(23) "option1" } [1]=&gt; array(1) { [247598]=&gt; string(24) "option2" } [2]=&gt; array(1) { [195666]=&gt; string(17) "option3" } [3]=&gt; array(1) { [195632]=&gt; string(22) "option..." } [4]=&gt; array(1) { [243763]=&gt; string(24) "option..." } [5]=&gt; array(1) { [196600]=&gt; string(13) "option..." } [6]=&gt; array(1) { [196597]=&gt; string(11) "option..." } [7]=&gt; array(1) { [196592]=&gt; string(16) "option..." } [8]=&gt; array(1) { [196549]=&gt; string(17) "option..." } [9]=&gt; array(1) { [251324]=&gt; string(10) "option..." } [10]=&gt; array(1) { [195564]=&gt; string(50) "option..." } } 


Here is my code:

      $result = drupal_http_request('https://'.$key.'@'.$company.'.example.com/example.json');
    $feed_array = json_decode($result-&gt;data, TRUE);
    $projects = array();
    foreach ($feed_array['todo-lists'] as $project) {
    $projects[] = array(
    $project['id'] =&gt; $project['name']
    );
    }
The easiest way to do it would be to iterate through the array

$options = array();
foreach($project as $option_group)
{
   $options[key($option_group)] = next($option_group);
}


Or, if you can't count on there being only one element in each option group, do:

$options = array();
foreach($project as $option_group)
{
   $options = array_merge($options, $option_group);
}