Jquery: Push array with key and value

Here is an example where I want to retrieve attribute values in a jquery AJAX function that a customer has selected when purchasing a product. The attribute values are some the customer chooses in some select boxes, it could be for example width, length, color etc. The data then needs to be sent with an AJAX Post request which is then used in a PHP function which adds the product to the basket with the selected attributes and attribute names, which is why I also want the attribute name and not just the value. In this example it is only shown how I find the data and save it as an array so that I can use it in my php add_to_cart function. That is to say it is just a small part of my jquery ajax function. I have however included part of the ajax part, to show a short bit of it.

Here is a code snippet up to $.ajax({:

function add_to_cart(product_id) {
      var selectedfilters = [];
        $('.variations select').each(function () {
                var name = $(this).data('attribute_name');
                var value = $(this).val();
            selectedfilters.push({[name]: value});
        url: LENNARTC.ajaxurl,
        type: 'POST',
        data: {
            action: 'ajax_atc',
            product: product_id,
              selectedfilters: selectedfilters

Remember the code snippet is just part of a full ajax add_to_cart function, and the post was mainly to show how to make an array with key in jquery.