My goal is to start with a JSON object. This is not the Object I will be working with, but it will do for the example.
var json = [
{"id":"1","age":"20", "region":"Y"},
{"id":"2", "age":"20", "region":"X"},
{"id":"3", "age":"31", "region":"Z"},
{"id":"4", "age":"35", "region":"Q"}
];
Lets say my goal is to sort the region based off of the age. I wish to create a function that will split json into this:
var newObj = [
[
{"id":"1","age":"20", "region":"Y"},
{"id":"2", "age":"20", "region":"X"}
],
[
{"id":"3", "age":"31", "region":"Z"}
],
[
{"id":"4", "age":"35", "region":"Q"}
]
];
Then I could sort the new arrays. I will never know what the ages will be or how many arrays I will need to be created. Thank you for your help.