Q:

JSON - find element

I have JSON that looks like this -
[{
    "Columnd58eae9aee6a43b9836e59254e914f43": 1,
    "Metric": "7e70661f-e266-4745-9b1b-c5c5691e9746",
    "MetricDisplay": "Active Users",
    "Pivot1": 40.00000,
    "Pivot2": 38.00000,
    "Pivot3": 18.00000,
    "Total": 96.00000,
    "Average": 32.00000,
    "IsTotal": 0,
    "MetricOrder": 1
}]

but in this example I have 3 "Pivot" columns, there could and most likely will be more. How do I determine the number of Pivot columns I have and the values for those elements using jQuery?

A:

Ideally, you'd use an array: 
Pivot: [ 40.00, 38.00, 18.00, ... ],

But you could solve this using bracket notation, something like this:
var i = 1;
while (data['Pivot' + i]) {
    console.log(data['Pivot' + i]);
    i++;
}

