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

Android

Data Parsing final Challenge Task 1 of 3

I'm having trouble with question 1 of 3 in the final code challenge for Data Parsing

link: http://teamtreehouse.com/library/build-a-blog-reader-android-app/getting-data-from-the-web/parsing-data-returned-in-json-format

Bummer! Make sure you set the 'name' variable using the 'name' property from 'data.json'. PreviewRecheck work JSONChallenge.java data.json

1 String name = jsonData.getString("Treehouse Book Series"); 2 String publisher = jsonData.getString("Wiley"); 3 String language = jsonData.getString("English");

I'm having trouble creating a screenshot

1 Answer

Hi Milan

I just went through the code challenge and the getString() method which i mentioned in another post is correct however you are trying to reference the 'actual' value which is incorrect.

When you reference JSON data you should reference the name of the information just like you reference a variable name to get the actual value contained within without actually knowing what that value is.

If you type the code below it should work just fine:

String publisher = jsonData.getString("publisher");
String name = jsonData.getString("name");
String language = jsonData.getString("language");

Hope this helps Daniel

Oh!!! Thanks so much! I really appreciate your help. That one was killing my brain. Lol