Object of class stdClass could not be converted to string error



PHP Snippet 1:

class stdClass#1 (2) {
  public $Coords =>
  array(5) {
    [0] =>
    class stdClass#2 (4) {
      public $Accuracy =>
      string(2) "65"
      public $Latitude =>
      string(18) "53.277720488429026"
      public $Longitude =>
      string(18) "-9.012038778269686"
      public $Timestamp =>
      string(39) "Fri Jul 05 2013 11:59:34 GMT+0100 (IST)"
    }
    [1] => (more of the same, edited for brevity)
    [2] =>
    [3] =>
    [4] =>
  }
  public $Scan =>
  string(8) "Whatever"
}

PHP Snippet 2:

return var_dump(json_encode($result[0]));

PHP Snippet 3:

string(34) "{"id":1,"content":"test database"}"

PHP Snippet 4:

 $decoded_traces=json_decode($traces);
 echo $decoded_traces;

PHP Snippet 5:

$decoded_traces=json_decode($traces, true);
print_r $decoded_traces;