Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript AJAX Basics (retiring) Programming AJAX Finish the JSON File

Tiffany White
Tiffany White
5,373 Points

I have four songs here...

There are four songs here so I don't know wtf I need to do.

songs.json
[ 
  {
    "title" : "Die, Die My Darling",
    "artist" : "The Misfits",
    "title" : "In Rainbows",
    "artist" : "Radiohead",
    "title" : "Sadness Is a Blessing",
    "artist" : "Lykke Li",
    "title" : "You Know You're Right",
    "artist" : "Nirvana"
  }
]

1 Answer

Damien Watson
Damien Watson
27,419 Points

Hi Tiffany,

Each song needs to be an individual object, wrapped in brackets. Otherwise you would be overwriting the previous 'title' and 'artist' in the same object. Try this:

[ 
  {
    "title" : "Die, Die My Darling",
    "artist" : "The Misfits"
  },
  {
    "title" : "In Rainbows",
    "artist" : "Radiohead"
  },
  {
    "title" : "Sadness Is a Blessing",
    "artist" : "Lykke Li"
  },
  {
    "title" : "You Know You're Right",
    "artist" : "Nirvana"
  }
]
Damien Watson
Damien Watson
27,419 Points

This gives you an array '[]' of 4 objects '{}', each with 'title' and 'artist' properties.