obj.attributes が次のリストにあるこの json 応答があります。ID を持つ各オブジェクトのみを通過したい..オブジェクトをトラバースして id 属性を出力するにはどうすればよいですか
Object {0: Object, 1: Object, 2: Object, 3: Object, subject_Keys: "", schoolapplication: Object}
私は試した
for(var item in obj.attributes)
{
var intRegex = /^\d+$/;
if(intRegex.test(item)) {
console.log(obj.attributes[item]["id"]) //This prints undefined
}
}
EDIT1:console.log(obj)
child {cid: "c33", changed: Object, attributes: Object, _changes: Array[0], _hasComputed: true…}
_changes: Array[0]
_changing: false
_currentAttributes: Object
_hasComputed: true
_pending: false
_previousAttributes: Object
app_id: 8
attributes: Object
changed: Object
cid: "c33"
__proto__: Surrogate
console.log(obj.attributes)
Object {0: Object, 1: Object, 2: Object, 3: Object, subject_Keys: "", schoolapplication: Object}
0: Object
name: "key1"
schoolapplication: Object
id: 3
__proto__: Object
1: Object
2: Object
3: Object
__proto__: Object