I have a local storage that looks like this:
Key: Savedme
Value:
{
"Bob":["1","1"],
"John":["2","1"],
"Mom":["3","1"],
"Dad":["1","2"],
"Tom":["3","2"],
"Skipper42":["2","3"],
"Hated_41":["3","3"],
"Greeneggs":["2","2"],
"William":["1","3"]
}
I need to sort it somehow to look like this
{
"Bob":["1","1"],
"Dad":["1","2"],
"William":["1","3"]
"John":["2","1"],
"Greeneggs":["2","2"],
"Skipper42":["2","3"],
"Mom":["3","1"],
"Tom":["3","2"],
"Hated_41":["3","3"]
}
I tried to save it in a matrix such as:
var $runthrough = [[]];
$runthrough[$x,$y] = $values;
Where x is the first set of numbers, y is the next, and then the values are Bob, Dad, etc .... from there I could just do foreach for both sections of the matrix, and this will be done, HOWEVER, when I use this method after it goes through one set of objects, the second set gives "undefined", although I set some triggers to check, and in fact this does not happen undefined.
var loadarray = JSON.parse(localStorage.getItem( 'savedme' ));
$.each(loadarray, function(k, v) {
if(typeof k === 'undefined' || !k){
console.error("undefined found at k!");
};
if(typeof v[0] === 'undefined' || !v[0]){
console.error("undefined found at x!");
};
if(typeof v[1] === 'undefined' || !v[1]){
console.error("undefined found at y!");
};
});
, , , - , , , THEN . , , :
{
"1":["1","Bob"],
"2":["1","John"],
}
... 1