How to get value from the JSON response

How to get value from the JSON response

Hi,

I get the following response from the server:



  1. {"aster":"3","daffodil":"4","rose":"3","totalItems":10,"totalPrice":"31.90"}


and, I want to put it in the table that will look like this:



The problem is that I do not know how to get values (for the "Quantity" column). This is my code:



  1. function processServerResponse(data) {
    if (data.products.length > 0) {
    $("#orderForm").hide();
    $("#summaryForm").show();
    var html = '';
    $.each(data.products, function(key, value) {
    html += "<tr><td>"+value.name+"</td><td>"+?????+"</td></tr>"
    });
    $(html).appendTo("tbody");
    $("#totalItems").text(data.totalItems);
    $("#totalPrice").text(data.totalPrice);
    }
    }


Before that, this is how my $.ajax looks like (it's bigger code, y ou don' have to read it out):

  1. $("#orderForm button").click(function (e) {
    e.preventDefault();
    var formData = $("#orderForm").serialize();
    $("#popup").show();
    $("body *").not("#popup").css("opacity", 0.5);
    $("input").prop("disabled", true);
    $.ajax({
    url: "http://localhost/",
    type: "post",
    data: formData,
    dataType: "json",
    dataFilter: function(data, dataType) {
    primljeniOdgovor = $.parseJSON(data);
    var cleanData = {
    totalItems: primljeniOdgovor.totalItems,
    totalPrice: primljeniOdgovor.totalPrice
    };
    delete primljeniOdgovor.totalItems;
    delete primljeniOdgovor.totalPrice;
    cleanData.products = [];
    for (prop in primljeniOdgovor) {
    cleanData.products.push({
    name: prop,
    quantity: data[prop]
    })
    }
    return cleanData;
    },
    converters: {
    "text json": function(data) {
    return data;
    }
    },
    success: function(data) {
    processServerResponse(data);
    },
    complete: function() {
    setTimeout(function() {
    $("#popup").hide();
    $("body *").not("#popup").css("opacity", 1);
    $("input").prop("disabled", false);
    }, 1500);
    }
    });
    })


I get the name from that response by value.name , but I have no idea how to get that value (quantity)?