[Fixed]-Getting javascript array from django json dumped dictionary

1👍

You could map all sorted keys for the values.

var object = { 7: { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 1, 12: 0 } },
    key = Object.keys(object)[0],
    keys = Object.keys(object[key]),
    array = keys.sort(function (a, b) { return a - b; }).map(function (k) { return object[key][k]; });

console.log('key', key);
console.log('array', array);

Leave a comment