-1

enter image description here

How do I get the value of BrandID?

asked Dec 27, 2013 at 7:28
7
  • Is this about getting a property, or about looping over all properties? Commented Dec 27, 2013 at 7:29
  • Getting a property value. Commented Dec 27, 2013 at 7:31
  • 1
    How about showing us what you've tried? Commented Dec 27, 2013 at 7:31
  • 1
    Try data[0].Item.BrandID Commented Dec 27, 2013 at 7:33
  • 1
    I down-voted for the level of lazy. This is something you could have easily found through a google search. Commented Dec 27, 2013 at 7:34

4 Answers 4

2

Use this yourObjectArray[0].Item.BrandID

answered Dec 27, 2013 at 7:31
Sign up to request clarification or add additional context in comments.

1 Comment

yourObjectArray[0].Item.BrandID I think.
0

For your example:

objRef[0]["Item"]["BrandID"]

or you can use:

objRef[0].Item.BrandID

For Iterating in your array you will use:

var i;
for(i=0; i < objRef.Length ; i++)
{
 var brandId = objRef[i].Item.BrandID;
 // or
 var brandId = objRef[i]["Item"]["BrandID"];
 // your code blocks to process blockId
}
answered Dec 27, 2013 at 7:33

5 Comments

Why do it in bracket notation?
It is just an example. You can use it in either way. Using Bracket notation helps in some cases.
Example or not, it's not where you'd use it.
Those cases being when the key name is unknown.
Correct. When key name is unknown or changes dynamically.
0

Go with this ..

ObjectArray[0].Item.BrandID
answered Dec 27, 2013 at 7:34

Comments

0

You mean this?

for(var i = 0, len = yourObjectArray.length; i < len; i++) {
 var youNeed = yourObjectArray[i].Item.BrandID;
}
answered Dec 27, 2013 at 7:37

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.