Trying to create a link in a custom module I have the following code
  `  class PopularContentParselyBlock extends BlockBase {

 /**
  * {@inheritdoc}
  */

 public function build() {
 $client = new \GuzzleHttp\Client();
 $res = $client-&gt;request('GET', 'http://www.APIURL.com');
 $decoded = json_decode($res-&gt;getBody(),TRUE);
 foreach($decoded['data'] as $article) {
    $url = Url::fromUri( $article['url']);
    $endpoint = Link::fromTextAndUrl($article['title'], $url);

    }
  return $endpoint-&gt;toRenderable();
  }
}


`

When it prints out though all I get us Object. What am I doing wrong?
#markup is used for content that has already been rendered. As the caller seems to be expecting a render array, you can just return it directly:

return $endpoint-&gt;toRenderable();