getParsedBody(); $filename = 'transparencia.yml'; $transparencia = $filemanager->folder('data')->load($filename); if (!$transparencia) { $transparencia = (object) [ 'descripcion' => '', 'funciones' => '', 'activo' => false ]; } if (isset($post['activo'])) { $transparencia->activo = json_decode($post['activo']); } $status = $filemanager->folder('data')->save($filename, $transparencia); $output = [ 'informacion' => $post, 'editado' => $transparencia, 'estado' => ($status !== false) ? 'ok' : 'error' ]; $response->getBody()->write(json_encode($output)); return $response ->withHeader('Content-Type', 'application/json') ->withStatus(201); } }