Background
I am creating an engine to pick up values from different JSON files, each with different structure. I am looking for ways to store the key as string (or array) in a static file, and use the key to get the value.
Keys in string or array form that are going to store in a static file may look like hello.world.that.is.something and that.is.something.different or in array ["hello", "world", "that", "is", "something"] and ["that", "is", "something", "different"].
Given the sample data below, is there any way that I can retreive the value [1, 2, 3, 4, 5] and Noo!!! from prebuild-keys (stored somewhere)?
Sample Data
let data = {
hello: {
world: {
that: {
is: {
something: [1, 2, 3, 4, 5]
}
}
}
},
that: {
is: {
something: {
different: "Noo!!!"
}
}
}
}
Expected Data
data[pre_build_keys_1] // [1, 2, 3, 4, 5]
data[pre_build_keys_2] // Noo!!!