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 trialRaeed Sabree
10,664 PointsAdd 3 more song objects to this JSON file, each with "title" and "artist" attributes.
what did i do wrong?
[
{
"title" : "My Way",
"artist" : "Frank Sinatra",
"title" : "My lay",
"artist" : "Frank Sinatra",
"title" : "My pay",
"artist" : "Frank Sinatra",
"title" : "My say",
"artist" : "Frank Sinatra",
"title" : "My tray",
"artist" : "Frank Sinatra"
}
]
2 Answers
Simon Coates
28,694 Pointsthis would be one more
[
{
"title" : "My Way",
"artist" : "Frank Sinatra"
},
{
"title" : "My Way",
"artist" : "Frank Sinatra"
}
]
you get the idea
Raeed Sabree
10,664 Pointsyeah okay now i get it
Sam Allen
7,176 PointsHere's a concrete example of the syntax you need to have:
[
{
"title" : "My Way",
"artist" : "Frank Sinatra"
},
{
"title" : "Walk This Way",
"artist" : "Aerosmith"
},
{
"title" : "Ace of Spades",
"artist" : "Motorhead"
},
{
"title" : "Glass Shatters",
"artist" : "Disturbed"
}
]
Simon Coates
28,694 PointsSimon Coates
28,694 PointsBecause object data is stored on a particular key, the effect of the above is that title and artist is set 5 times on a single object. The resulting object from your code is [{"title":"My tray","artist":"Frank Sinatra"}]. If each song is an individual object, then title and artist can be properties on each individual song.