public function toJson() { $json['type'] = $this->getType(); $json['coordinates'] = $this->toArray(); return json_encode($json); }