Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP File Handling with PHP Parsing Specific Formats Reading JSON

Artan Muzhaqi
Artan Muzhaqi
7,983 Points

Why do you use $books->collections what's that for ?

why don't we just use $books->title

Julien Steel
Julien Steel
10,790 Points

If you look at the JSON file you'll see that the object collections contains the array books

{
    "collection": {
        "books": [
            {
                "title": "Sams Teach Yourself SQL\u2122 in 10 Minutes",
                "link": "https://www.goodreads.com/review/show/1874591524?utm_medium=api&utm_source=rss",
                "book_image_url": "https://images.gr-assets.com/books/1348383230s/173346.jpg",
                "book_description": "Offering a tutorial to the themes and techniques involved in applying the SQL language, this book includes coverage of versions of major commercial SQL platforms. It also covers MySQL, and PostgreSQL. It contains examples which have been tested against each SQL platform, with incompatibilities or platform distinctives called out and explained.",
                "num_pages": "242",
                "author_name": "Ben Forta",
                "isbn": "0672325675",
                "average_rating": "3.90",
                "book_published": "1999"
            },