$section) { foreach ($section as $name => $val) { $jsonData["$key.$name"] = $val; } } $this->data = json_encode($jsonData, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); } else { $this->data = null; } } public function getData() { return $this->data; } }