Drupal.settings merging when using AJAX
So when you use drupal_add_js to add settings during an ajax callback, this indeed merges the results. On the server side this is done in ajax_render (called from ajax_deliver or equivalent) which adds an ajax_command_settings command, instructing it to merge the results.

On the client side the merging is done by calling jQuery.extend, which causes the behaviour you have seen, and cannot be changed.

There is no work around if you want your results to be inserted into Drupal.settings. However you can pass your settings to your behaviour directly without using Drupal.settings. For this you would add a call to ajax_command_settings yourself. It would be something like this:

function mymodule_ajax_callback() {
  $commands = array();
  // ...
  $commands[] = ajax_command_settings(array(
    'key1' =&gt; 'value1',
    'key2' =&gt; 'value2',
  ));
  ajax_deliver(array(
    '#type' =&gt; 'ajax',
    '#commands' =&gt; $commands
  ));
}


Note that if your callback is called fom the Form API's #ajax['callback'] then it runs ajax_deliver on the value returned by the callback, so you shouldn't call it yourself.

On your script on the client side, your settings will be available as the second parameter of your behaviour attach method:

Drupal.behaviors.mymodule = {
  attach: function (context, settings) {
    // Here settings contains your settings
  }
};


(edit: sorry, previous answer was very wrong)