Last active
July 18, 2021 18:23
-
-
Save Kos-M/8bd489de4fed6afd322c7e48aaa2397f to your computer and use it in GitHub Desktop.
Js Simple Convert object of Objects to Array of Objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initial = { | |
BTC: { | |
available: '0.00000000', | |
onOrder: '0.00000000', | |
}, | |
LTC: { | |
available: '0.00000000', | |
onOrder: '0.00000000', | |
}, | |
}; | |
const result = Object.keys(initial).map((i) => ({ [i]: initial[i] })); | |
// result is : | |
// [ | |
// { BTC: { available: '0.00000000', onOrder: '0.00000000' } }, | |
// { LTC: { available: '0.00000000', onOrder: '0.00000000' } } | |
// ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment