背景
我正在创建一个引擎来从different JSON文件中获取值,每个文件都带有different structure. 我正在寻找进入store the key as string (or array)静态文件的方法,并使用键来获取值。
要存储在静态文件中的字符串或数组形式的键可能看起来像hello.world.that.is.somethingandthat.is.something.different或在数组["hello", "world", "that", "is", "something"]and中["that", "is", "something", "different"]。
鉴于下面的示例数据,有什么方法可以从预构建密钥(存储在某处)中检索值[1, 2, 3, 4, 5]和值?Noo!!!
样本数据
let data = {
hello: {
world: {
that: {
is: {
something: [1, 2, 3, 4, 5]
}
}
}
},
that: {
is: {
something: {
different: "Noo!!!"
}
}
}
}
预期数据
data[pre_build_keys_1] // [1, 2, 3, 4, 5]
data[pre_build_keys_2] // Noo!!!
GCT1015
梵蒂冈之花
RISEBY
开心每一天1111
相关分类