Reputation: 47
"DurationDetail" : {
"Manual" : [
{"Time" : "600000","Note" : "","TimeStamp" : ISODate("2017-01-13T06:12:22.485Z")}],
"Automated" :{"Time" : "5000"}},
I want to access Manual.Time ? how to access that ?
Upvotes: 0
Views: 55
Reputation: 1322
I am feeling that your code is incomplete.It should be object. Object should be
var obj = {
"DurationDetail" : {
"Manual" : [
{"Time" : "600000","Note" : "","TimeStamp" : ISODate("2017-01- 13T06:12:22.485Z")}],
"Automated" :{"Time" : "5000"}},
}
ans is
obj.DurationDetail.Manual[0].Time
DurationDetail contains an object and Manual is array so you can access it by obj.DurationDetail.Manual
.
0th Element contain an object with field Time.
Access by obj.DurationDetail.Manual[0].Time
Upvotes: 1
Reputation: 3620
If you have multiple array of manual then you can do it looping through manual array of duration detail object
for ( var i=0;i< DurationDetail.Manual.length;i++ )
{
console.log(DurationDetail.Manual[i].Time);
}
Upvotes: 1