public ActionResult GenerateReportJson([FromBody] ObjWrapper obj) { try { return(File(_generator.GenerateCleanReport(obj.student, obj.details).ToArray(), "application/pdf", "generatedReport.pdf")); } catch (Exception ex) { return(BadRequest(ex.ToString())); } /*try * { * //ObjWrapper obj = (ObjWrapper)JsonSerializer.Deserialize<ObjWrapper>(json); * return File(_generator.GenerateCleanReport(obj.student, obj.details), "application/pdf", "generatedReport.pdf"); * } * catch(JsonException ex) * { * return BadRequest(ex.ToString()); * }*/ }