将String转换为特定的类对象

时间:2016-06-16 11:29:57

标签: quartz-scheduler

有一个表名为“Scheduler_Details”的字段,其值为:

[{“reportScheduledId”:3980,“reportId”:4353,“frequency”:“每日”,“dataSelection”:“报告日期”,“scheduledTime”:“15:52”,“contentType”:“运行现在”, “用户id”: “5”, “用户类型”: “”, “schedulerName”: “Test7June4”, “isAutoSplited”:假 “particularDay”: “1”, “dataSelectionTypes”:[], “runFlag” :假的, “ReportmailIds”: “ram.newas@progenbusiness.com”, “isReportSchedule”:真实的, “isExportReportSchedule”:假的, “schedulerLoadId”:0, “fromOneview”:假的, “fromdsrbKpi”:假的, “forConditonalTest” :假 “quickRefreshReport”:假 “的contextPath”: “”, “advHtmlFileProps”: “”, “文件名”: “”, “oneviewid”:0 “oneviewMeasureOptions”:[], “usrMesg”: “”, “moduleType”: “”, “isGO”:假 “QueryScheduler”:真 “queryScheduleNow”: “00:00”}]

问题是从JAVA中的ResultSet获取后,它是“String”BUT的类型 我需要ReportSchedule的对象类型

ReportSchedule是一个具有所有这些值的setter和getter的类;

1 个答案:

答案 0 :(得分:0)

使用json序列化程序(Newtonsoft.Json是大多数人使用C#的程序包)

string response = ".....";
var rs = JsonConvert.DeserializeObject<ReportSchedule>(response);
相关问题