SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This just be so obvious but I it seems not. Below I stripped out some of the code for clarity

 var list = context.get_web().get_lists().getByTitle('SMenuLink')

 //usual code to open a list using CSOM

  //a array to hold our JSon stringifer objects
  var subMenuItems = [];

 // loop through the list
    var subMenuItem = JSON.stringify(listItem.get_fieldValues());

    // create a Json Object with sringifier


Now I want to reference the one of the array items and pick the field value

  var daniel = subMenuItems[0].SubMenuItemText;

I can see that array item [0] looks perfect in firebug but I not for the first time in my life am still "undefined"!!!! Therefore, my syntax is obviously wrong.....

share|improve this question

I am not a Client API expert by any means, but does get_fieldValues() get JUST the field values?

I thought it would store an object like: {"Title":"Task 1","SubMenuItemId":"1","SubMenuItemText":"My funcky text"}

Maybe you need to seperate the field title and field value in your "var daniel = subMenuItems[0].SubMenuItemText;" line?

Just a thought,


share|improve this answer
Mark I think you are on the right lines and yes the object array as seen in firebug looks exactly like you have depicted. It will be something like subMenuItems.somthng[0].SubMenuItemText; – westerdaled Feb 20 '13 at 11:55
Mark, Jimmy and Alex.... After a bit of time staring blankly at FF ... It dawned on my that I was just dealing an array of strings in json format and not objects. Tried every thing I could think of to instanstiate the json on object with a {} syntax..all I acheived was a headache and multiple FF crashes. Then after a bit of googling I spotted this . Thereafter, the answer was obvious – westerdaled Feb 21 '13 at 13:28
var daniel = JSON.parse(subMenuItems[0]); daniel.subMenuItemText; // at last I am not undefined!!! – westerdaled Feb 21 '13 at 13:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.