How can i filter out stdClass object to string

I have a PHP script that connects to our hosting provider’s api to get the domain info.
With the following snippet i can get the data in stdClass format how can i apply html / css styling to it?

for each record i want to display it nicly like

  • domain name: | test.com
  • expiraion date: | 2023-06-27T11:26:35:13Z …

Code to get output:

var_dump(
    $json = json_decode($response->getBody()->getContents())

);

Example output:

 object(stdClass)[36]
  public 'domain_name' => string 'test.com' (length=12)
  public 'expiration_date' => string '2023-06-27T11:26:35.13Z' (length=23)
  public 'will_renew' => boolean true
  public 'name_servers' => 
    array (size=2)
      0 => 
        object(stdClass)[34]
          public 'name' => string 'xx.xx.net' (length=15)
          public 'ip' => string 'xx.xxx.xx.xxx' (length=13)
      1 => 
        object(stdClass)[17]
          public 'name' => string 'xxx.xxxxxx.xxx' (length=15)
          public 'ip' => string 'xx.xx.xx.xx' (length=12)
  public 'registrant' => 
    object(stdClass)[30]
      public 'first_name' => string '' (length=0)
      public 'last_name' => string 'xx xx' (length=20)
      public 'address' => string 'xx  21' (length=19)
      public 'postal_code' => string '8470' (length=4)
      public 'city' => string 'Gistel' (length=6)
      public 'country_code' => string 'BE' (length=2)
      public 'email' => string '[email protected]' (length=16)
      public 'fax' => string '+32.xx' (length=12)
      public 'phone' => string '+32.xx' (length=12)
      public 'language_code' => null
      public 'company_name' => string 'xx & xx xx' (length=24)
      public 'enterprise_number' => string 'xx.xx.xx' (length=14)
  public 'can_toggle_renew' => boolean true