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 Build a Weather App (2015) Working with JSON Using JSONObject

alex gwartney
alex gwartney
8,849 Points

Help with json parsing?

So im needing some sort of explanation for this quiz its not really making any sense to me of what they are wanting me to type. Did they already declare a new json object?

JSONChallenge.java

data.json
{
    "name":"Treehouse Book Series",
    "publisher":"Wiley",
    "language":"English",
    "books":[
        {
            "title":"HTML5 Foundations",
            "author":"Matt West",
            "pages":384
        },
        {
            "title":"CSS3 Foundations",
            "author":"Ian Lunn",
            "pages":352
        }
    ]
}

1 Answer

Dan Johnson
Dan Johnson
40,532 Points

Yes, there's a JSONObject named jsonData that has been declared for you. Sometimes additional information on the challenge is mentioned in the comments instead of the instructions so it can be easy to miss.

So all you need to do is use jsonData to create the Strings name, publisher, and language.