What you are looking for is the really cool for in loop in JavaScript.
for in loops grab your properties. Given your example JSON object a for in loop would look like and do the following:
for (var foo in theJSONObject) {
// foo will be 'min', then 'max'
// to access the sub-groups of min and max you just need another for in loop
for (var spam in foo) { // Here we get 'type' and 'data'
// Here is where JavaScript magic happens!
theJSONObject[foo][spam];
// on the first iteration the above line will access theJSONObject variable
// like this theJSONObject.min.type
// this is because the [] operators on an object will grab the property named
// by what is passed in to them
// example: myWolverineObject['numClaws'] is the same as
// myWolverineObject.numClaws
}
}
Alternatively, you can use Object.keys(theJSONObject) to get an array of the properties of the object you can iterate through (in this case it would return ['min', 'max'] ).
In jQuery you can also do the following with the $.each operator
$.each (theJSONObject, function (key , value) {
// The keys would be 'min' and 'max' and values would be 'type' and 'data'
// off the bat!!
});
Hope this helps!!