Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8915589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:00:20+00:00 2026-06-15T05:00:20+00:00

Having read all the articles I can find I’m left wondering if the json

  • 0

Having read all the articles I can find I’m left wondering if the json data is valid.

I’m using php to make this request :

$myjson= file_get_contents('http://slhassall.rightboatexpert.com/api/boats');
 var_dump(json_decode($myjson));

and this dumps the below to the page, is it valid json?

object(stdClass)[1]

  public 'pagination' =>

    object(stdClass)[2]

      public 'total' => int 32

      public 'num_per_page' => int 25

      public 'page' => int 1

  public 'results' => 

    array (size=25)

      0 => 

        object(stdClass)[3]

          public 'id' => int 54

          public 'manufacturer' => string 'Utrecht' (length=7)

          public 'condition' => string 'used' (length=4)

          public 'model' => string 'Iron Sailing Barge' (length=18)

          public 'marketing_status' => string 'For Sale' (length=8)

          public 'year' => null

          public 'stock_number' => null

          public 'location' => string 'Suffolk' (length=7)

          public 'description' => string 'Clipper design. Built in Utrecht 1988, 25m in

length, an elegantly converted Dutch sailing barge with fantastic internal and external

 social entertainment /display spaces. Suitable for corporate or pri' (length=201)

          public 'sale_status' => string 'For Sale' (length=8)

          public 'price' => int 149000

          public 'currency' => string 'GBP' (length=3)

          public 'thumbnail' => string '/api/images/262' (length=15)

          public 'boat_image_id' => int 262

      1 => 

        object(stdClass)[4]

          public 'id' => int 51

          public 'manufacturer' => string ' Wood' (length=5)

          public 'condition' => string 'used' (length=4)

          public 'model' => string 'MFV/Guard vessel ' (length=17)

          public 'marketing_status' => string 'For Sale' (length=8)

          public 'year' => int 1959

          public 'stock_number' => null

          public 'location' => string 'Great Yarmouth, Norfolk UK' (length=26)

          public 'description' => string '' (length=0)

          public 'sale_status' => string 'For Sale' (length=8)

          public 'price' => int 35000

          public 'currency' => string 'GBP' (length=3)

          public 'thumbnail' => string '/api/images/219' (length=15)

          public 'boat_image_id' => int 219

      2 => 

I ask because when i attempt to connect to a node:

 $array = (json_decode($myjson));
    echo $array->boat->manufacturer;

I get this error:

Notice: Undefined property: stdClass::$boat in C:\wamp\www\json\index.php on line 6

Notice: Trying to get property of non-object in C:\wamp\www\json\index.php on line 6

With line 6 being the echo statement.
I have Googled these error codes but can’t figure it out.

Any help would be appreciated.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:00:21+00:00Added an answer on June 15, 2026 at 5:00 am

    Your JSON is valid, as invalid JSON would result in returning NULL:
    http://php.net/manual/en/function.json-decode.php
    Though I recommend you to do a checking after calling json_decode so that you know what is going on when you access the object later and found that you are accessing property of non-object (i.e. NULL)

    You get the error because your object isn’t structured that way – as your var_dump told you, there is no property boat in the resultant object.

    From your var_dump, it means the object has two properties pagination and results. In
    results there is an array consisting 25 items. In each item there is an object having properties id, manufacturer, condition and so on.

    And, indeed your question contains no JSON, php var_dump does not give you a JSON…

    I am not sure what do you want to do. I guess you want to print all manufacturers of each boat, so… (untested)

    $object = json_decode($myjson);
    if ($object == null) {
        // json is invalid, or $myjson actually contains NULL
    } else {
        $array = $object->results;
    
        foreach ($array as $item) {
            echo $item->manufacturer;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched all over stackoverflow and I can't find the answer that pertains
first of all, I have read a lot of articles (and questions) here and
i'd like to read binary data from a blob, using the Stream interface around
All - Have read various articles on the new keyword and when it should
Having read the documentation for VPython and GTK threading , it seems to me
Having read other people's questions I thought window.onload=... would answer my question. I have
Having read Joe Armstrong's book and watched Kevin Smith screencasts I've built a simple
Having read this link on RBAR and this , my understanding of RBAR amounts
Having read the documentation of Java's String class, it doesn't appear to support popping
Having read around it appears this should be possible. I have the following content

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.