Github repository for your stars.
$ npm install json-function
import { toArray } from 'json-function';
Example Data
const data = {'SpahhfW88GEcnVEXBkSB': {name: 'John'},'kDdjXxZWZwzKfYOyLUkE': {name: 'Mike'},'yPND1ItYbQXgoBXIAsz8': {name: 'Dan'}};
Default key
toArray(data);
Output
[{uid: 'SpahhfW88GEcnVEXBkSB',name: 'John'},{uid: 'kDdjXxZWZwzKfYOyLUkE',name: 'Mike'},{uid: 'yPND1ItYbQXgoBXIAsz8',name: 'Dan'}];
Use custom key
toArray(data, { key: '_id_' });
Output
[{_id_: 'SpahhfW88GEcnVEXBkSB',name: 'John'},{_id_: 'kDdjXxZWZwzKfYOyLUkE',name: 'Mike'},{_id_: 'yPND1ItYbQXgoBXIAsz8',name: 'Dan'}];