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

Challenge 1 - Parsing Data how do you set String variables to the values from 'data.json' using the 'jsonData' object?

This is what I've got, but I keep getting compiler errors:

String name = jsonData.getJSONString("Treehouse Book Series");
String publisher = jsonData.getJSONString("Wiley");
String language = jsonData.getJSONString("English");

Edited your comment to add syntax highlighting. :)

1 Answer

Hi Milan

You have added in an incorrect method call which is the reason for the complier errors. You should be Using a line such as:

String name = jsonData.getString("Treehouse Book Series");

Simply remove the "JSON" between the get and String on each of your declarations and you should be set, although let me know if you have anymore problems

Thanks Daniel

Hey Daniel,

I'm still getting errors. Any other suggestions?

Looks like you also mixed up the name and publisher strings.