Json parsing problems with node.js

I am new to programming and I am trying to learn node.js and CoffeeScript. I have read a few books and watched some screencasts. And now I have started to code. Now I faced my first problem and was not able to solve it with Google. Already lost a few hours and I am stuck. Maybe someone can give me a light. Here is the problem. I have this json file:

{
  "title": "title",  
  "pages": [ 
    { "name": "Page1", "url": "#Page1", "class": "class", "template":"templateName" }, 
    { "name": "Page2", "url": "#Page2", "class": "class", "template":"templateName" },
    { "name": "Page3", "url": "#Page3", "class": "class", "template":"templateName" }, 
    { "name": "Page4", "url": "#Page4", "class": "class", "template":"templateName" }, 
    { "name": "Page5", "url": "#Page5", "class": "class", "template":"templateName" } 
  ]
}

and the code to get the json file is

configFile = require(file.json)

If I do

console.log(configFile.pages)

I can get the correct information.

But if I do

console.log(configFile.pages.template[0])

I get an undefined error.

Can anyone give me a hand?

configFile.pages[0].template

it's your structure :)

template is not an array, pages is. So use this:

console.log(configFile.pages[0].template);