Sorry I don't know how to phrase the question title. Please help edit if possible.
I have an object like this:
{
a: 'jack',
b: {
c: 'sparrow',
d: {
e: 'hahaha'
}
}
}
I want to make it look like:
{
'a': 'jack',
'b.c': 'sparrow',
'b.d.e': 'hahaha'
}
// so that I can use it this way:
a['b.d.e']
jQuery is ok too. I know for the nested object, I can use a.b.d.e
to get hahaha
, but today I have to use it like a['b.d.e']
-_-!!!
How can I achieve this? Thanks in advance :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…