This is the JSON I'm trying to create programmatically:
{
    "sensors": [{
        "x": 342,
        "y": 213,
        "id": 4
    }, {
        "x": 642,
        "y": 913,
        "id": 3
    }, {
        "x": 452,
        "y": 113,
        "id": 2
    }]
}
I have to iterate through all elements with a specific class to retrieve the data for the json:
$(".marker").each(function()
{
    var x = $(this).attr("data-x");
    var y = $(this).attr("data-y");
    var id = $(this).attr("data-id");
});
How could I create the json object to be like I described?