0
 "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 ?

1
  • 4
    obj.DurationDetail.Manual[0].Time, Note: Manual is an array hence [] Commented Feb 3, 2017 at 12:01

2 Answers 2

1

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);
 }
Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.