You're treating the JSON object like a list. It's an object.
var count = Object.keys(data).length;
alert(count);
So we know that Object.keys(data).length counts all of the keys. So its stand to reason we can select those keys individually. Object.keys(data)[i]. You can loop over it and wrap it with an IF for every 2n+2 items.
for (var i = 0; i < Object.keys(data).length; i++) {
if (i%2 == 0) {
# this will do something for every even element
};
}
I would suggest wrapping everything with a class (so no if statement). And then using the CSS selector 2n+2 (if you're trying to accomplish something with CSS).