I am working with a dictionary-like variable in JavaScript, named "dict".
var dict = {
val1 : ["a", "b", "c"],
val2 : ["d", "e", "f"],
val3 : ["g", "h", "i"],
...
}
My goal is to extract val1, val2, val3 and store them in an array to display as JSON.
{
"Configs" : [
"val1" : ["a", "b", "c"],
"val2" : ["d", "e", "f"],
"val3" : ["g", "h", "i"],
]
}
I am wondering if it's feasible to push these key-value pairs into an array. And how can I access these values? arr[1].key()?
arr =
[
{val1 : ["a", "b", "c"]},
{val2 : ["d", "e", "f"]},
{val3 : ["g", "h", "i"]},
]