struct = $struct; } public static function new(mixed $struct): Json { return new Json($struct); } public static function error(mixed $msg): Json { return new Json([ 'type' => 'error', 'msg' => $msg, ]); } public function jsonSerialize(): array { return $this->struct; } public function die() { print(json_encode($this->struct)); die(); } }