通过 `new Function` 来做, 如果为了防止出错, 可以在里面加 try/catch
```javascript
var a = {
"obj": {
"id": "1",
"value": "2",
"test":[
{x:123, y:{z:9999,a:[555]}}
]
},
"name" : "3"
}
function getValue (obj, key) {
return new Function('x', 'return x.' + key)(obj)
}
console.log(getValue(a, '
obj.id'))
console.log(getValue(a, 'name'))
console.log(getValue(a, 'obj.test[0].x'))
console.log(getValue(a, 'obj.test[0].y.z'))
console.log(getValue(a, 'obj.test[0].y.a[0]'))
```