1) json:
[[{"Id":6,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-02-01T00:00:00Z","Power":3633976.6,"EstimatedPower":3529887.3134946576,"Consumption":210687.426175765,"Temperature":-16.0,"Deviation":-2.864335629055581,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":7,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-03-01T00:00:00Z","Power":3087296.2,"EstimatedPower":2937010.8697607126,"Consumption":181808.811123168,"Temperature":-4.5,"Deviation":-4.8678623787146709,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":8,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-04-01T00:00:00Z","Power":3789773.0,"EstimatedPower":4062749.0288516344,"Consumption":248780.849474034,"Temperature":-9.9,"Deviation":7.2029651604894163,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":9,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-05-01T00:00:00Z","Power":4147530.6,"EstimatedPower":4013436.2063861224,"Consumption":249512.711123168,"Temperature":-4.7,"Deviation":-3.2331140272690906,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":10,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-06-01T00:00:00Z","Power":3526440.2,"EstimatedPower":3646342.5469404678,"Consumption":234718.429474034,"Temperature":6.6,"Deviation":3.4000958513479951,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":11,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-07-01T00:00:00Z","Power":3246991.6,"EstimatedPower":3168656.9042940191,"Consumption":211549.901123168,"Temperature":16.0,"Deviation":-2.4125315170504646,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":12,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-08-01T00:00:00Z","Power":2396363.0,"EstimatedPower":2416626.8007339239,"Consumption":159345.971123168,"Temperature":9.5,"Deviation":0.84560647672844436,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false}],[{"Id":114,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-02-01T00:00:00Z","Power":1021862.2,"EstimatedPower":1076057.4491338292,"Consumption":89701.7655810564,"Temperature":-16.0,"Deviation":5.3035770511747238,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":115,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-03-01T00:00:00Z","Power":1144715.8,"EstimatedPower":1108039.9497605087,"Consumption":89681.9904647411,"Temperature":-4.5,"Deviation":-3.2039262705635174,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":116,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-04-01T00:00:00Z","Power":1074957.4,"EstimatedPower":1182082.0678394337,"Consumption":96818.4488368462,"Temperature":-9.9,"Deviation":9.9654802915384089,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":117,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-05-01T00:00:00Z","Power":1243359.8,"EstimatedPower":1239392.9877877974,"Consumption":100238.590464741,"Temperature":-4.7,"Deviation":-0.31903976726629368,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":118,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-06-01T00:00:00Z","Power":1094505.4,"EstimatedPower":1239985.6629106368,"Consumption":97751.6488368462,"Temperature":6.6,"Deviation":13.291872558201812,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":119,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-07-01T00:00:00Z","Power":766071.2,"EstimatedPower":1293214.0524931694,"Consumption":99903.100464741,"Temperature":16.0,"Deviation":68.811208735319823,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":120,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-08-01T00:00:00Z","Power":2048921.6,"EstimatedPower":1243607.6504395444,"Consumption":97391.090464741,"Temperature":9.5,"Deviation":-39.304283265911963,"Excluded":[3],"IsOutlier":true,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false}],[{"Id":66,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-02-01T00:00:00Z","Power":2375411.4,"EstimatedPower":2598429.5959766749,"Consumption":241303.937741935,"Temperature":-16.0,"Deviation":9.38861352507927,"Excluded":[4],"IsOutlier":true,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":67,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-03-01T00:00:00Z","Power":2816367.0,"EstimatedPower":2761899.1710119839,"Consumption":270116.242857143,"Temperature":-4.5,"Deviation":-1.9339748331100304,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":68,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-04-01T00:00:00Z","Power":2885174.8,"EstimatedPower":2951451.2435807148,"Consumption":283105.451152074,"Temperature":-9.9,"Deviation":2.2971378919819596,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":69,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-05-01T00:00:00Z","Power":3089902.2,"EstimatedPower":2900149.1745301066,"Consumption":283664.742857143,"Temperature":-4.7,"Deviation":-6.1410689784904378,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":70,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-06-01T00:00:00Z","Power":3227620.0,"EstimatedPower":2780273.3585052835,"Consumption":284044.431152074,"Temperature":6.6,"Deviation":-13.859953820298443,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":71,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-07-01T00:00:00Z","Power":2471207.0,"EstimatedPower":2790993.2908156421,"Consumption":295357.502857143,"Temperature":16.0,"Deviation":12.940489842236701,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":72,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-08-01T00:00:00Z","Power":2751209.6,"EstimatedPower":2848408.6166038075,"Consumption":293990.002857143,"Temperature":9.5,"Deviation":3.5329557080568286,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false}]]
2) 代码:
string jsonList;
List<EnergyPlanningResult> allData;
try
{
allData = JsonConvert.DeserializeObject<List<EnergyPlanningResult>>(jsonList);
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
错误消息为:
Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'MonitoringOfEnergyConsumption.Controllers.EnergyPlanningResult' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '[0]', line 1, position 2.
我检查了json文件,它是有效的。
我不知道发生了什么事。
答案很简单,你的json:
[[{"Id":6,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-02-01T00:00:00Z","Power":3633976.6,"EstimatedPower":3529887.3134946576,"Consumption":210687.426175765,"Temperature":-16.0,"Deviation":-2.864335629055581,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":7,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-03-01T00:00:00Z","Power":3087296.2,"EstimatedPower":2937010.8697607126,"Consumption":181808.811123168,"Temperature":-4.5,"Deviation":-4.8678623787146709,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":8,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-04-01T00:00:00Z","Power":3789773.0,"EstimatedPower":4062749.0288516344,"Consumption":248780.849474034,"Temperature":-9.9,"Deviation":7.2029651604894163,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":9,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-05-01T00:00:00Z","Power":4147530.6,"EstimatedPower":4013436.2063861224,"Consumption":249512.711123168,"Temperature":-4.7,"Deviation":-3.2331140272690906,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":10,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-06-01T00:00:00Z","Power":3526440.2,"EstimatedPower":3646342.5469404678,"Consumption":234718.429474034,"Temperature":6.6,"Deviation":3.4000958513479951,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":11,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-07-01T00:00:00Z","Power":3246991.6,"EstimatedPower":3168656.9042940191,"Consumption":211549.901123168,"Temperature":16.0,"Deviation":-2.4125315170504646,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":12,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-08-01T00:00:00Z","Power":2396363.0,"EstimatedPower":2416626.8007339239,"Consumption":159345.971123168,"Temperature":9.5,"Deviation":0.84560647672844436,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false}],[{"Id":114,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-02-01T00:00:00Z","Power":1021862.2,"EstimatedPower":1076057.4491338292,"Consumption":89701.7655810564,"Temperature":-16.0,"Deviation":5.3035770511747238,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":115,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-03-01T00:00:00Z","Power":1144715.8,"EstimatedPower":1108039.9497605087,"Consumption":89681.9904647411,"Temperature":-4.5,"Deviation":-3.2039262705635174,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":116,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-04-01T00:00:00Z","Power":1074957.4,"EstimatedPower":1182082.0678394337,"Consumption":96818.4488368462,"Temperature":-9.9,"Deviation":9.9654802915384089,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":117,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-05-01T00:00:00Z","Power":1243359.8,"EstimatedPower":1239392.9877877974,"Consumption":100238.590464741,"Temperature":-4.7,"Deviation":-0.31903976726629368,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":118,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-06-01T00:00:00Z","Power":1094505.4,"EstimatedPower":1239985.6629106368,"Consumption":97751.6488368462,"Temperature":6.6,"Deviation":13.291872558201812,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":119,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-07-01T00:00:00Z","Power":766071.2,"EstimatedPower":1293214.0524931694,"Consumption":99903.100464741,"Temperature":16.0,"Deviation":68.811208735319823,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":120,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-08-01T00:00:00Z","Power":2048921.6,"EstimatedPower":1243607.6504395444,"Consumption":97391.090464741,"Temperature":9.5,"Deviation":-39.304283265911963,"Excluded":[3],"IsOutlier":true,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false}],[{"Id":66,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-02-01T00:00:00Z","Power":2375411.4,"EstimatedPower":2598429.5959766749,"Consumption":241303.937741935,"Temperature":-16.0,"Deviation":9.38861352507927,"Excluded":[4],"IsOutlier":true,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":67,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-03-01T00:00:00Z","Power":2816367.0,"EstimatedPower":2761899.1710119839,"Consumption":270116.242857143,"Temperature":-4.5,"Deviation":-1.9339748331100304,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":68,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-04-01T00:00:00Z","Power":2885174.8,"EstimatedPower":2951451.2435807148,"Consumption":283105.451152074,"Temperature":-9.9,"Deviation":2.2971378919819596,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":69,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-05-01T00:00:00Z","Power":3089902.2,"EstimatedPower":2900149.1745301066,"Consumption":283664.742857143,"Temperature":-4.7,"Deviation":-6.1410689784904378,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":70,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-06-01T00:00:00Z","Power":3227620.0,"EstimatedPower":2780273.3585052835,"Consumption":284044.431152074,"Temperature":6.6,"Deviation":-13.859953820298443,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":71,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-07-01T00:00:00Z","Power":2471207.0,"EstimatedPower":2790993.2908156421,"Consumption":295357.502857143,"Temperature":16.0,"Deviation":12.940489842236701,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":72,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-08-01T00:00:00Z","Power":2751209.6,"EstimatedPower":2848408.6166038075,"Consumption":293990.002857143,"Temperature":9.5,"Deviation":3.5329557080568286,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false}]]
不是有效的json。这是因为双方形支架。
去掉一个方括号,你就会像洛克一样:
[{"Id":6,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-02-01T00:00:00Z","Power":3633976.6,"EstimatedPower":3529887.3134946576,"Consumption":210687.426175765,"Temperature":-16.0,"Deviation":-2.864335629055581,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":7,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-03-01T00:00:00Z","Power":3087296.2,"EstimatedPower":2937010.8697607126,"Consumption":181808.811123168,"Temperature":-4.5,"Deviation":-4.8678623787146709,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":8,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-04-01T00:00:00Z","Power":3789773.0,"EstimatedPower":4062749.0288516344,"Consumption":248780.849474034,"Temperature":-9.9,"Deviation":7.2029651604894163,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":9,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-05-01T00:00:00Z","Power":4147530.6,"EstimatedPower":4013436.2063861224,"Consumption":249512.711123168,"Temperature":-4.7,"Deviation":-3.2331140272690906,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":10,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-06-01T00:00:00Z","Power":3526440.2,"EstimatedPower":3646342.5469404678,"Consumption":234718.429474034,"Temperature":6.6,"Deviation":3.4000958513479951,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":11,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-07-01T00:00:00Z","Power":3246991.6,"EstimatedPower":3168656.9042940191,"Consumption":211549.901123168,"Temperature":16.0,"Deviation":-2.4125315170504646,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":12,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-08-01T00:00:00Z","Power":2396363.0,"EstimatedPower":2416626.8007339239,"Consumption":159345.971123168,"Temperature":9.5,"Deviation":0.84560647672844436,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false}],[{"Id":114,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-02-01T00:00:00Z","Power":1021862.2,"EstimatedPower":1076057.4491338292,"Consumption":89701.7655810564,"Temperature":-16.0,"Deviation":5.3035770511747238,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":115,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-03-01T00:00:00Z","Power":1144715.8,"EstimatedPower":1108039.9497605087,"Consumption":89681.9904647411,"Temperature":-4.5,"Deviation":-3.2039262705635174,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":116,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-04-01T00:00:00Z","Power":1074957.4,"EstimatedPower":1182082.0678394337,"Consumption":96818.4488368462,"Temperature":-9.9,"Deviation":9.9654802915384089,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":117,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-05-01T00:00:00Z","Power":1243359.8,"EstimatedPower":1239392.9877877974,"Consumption":100238.590464741,"Temperature":-4.7,"Deviation":-0.31903976726629368,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":118,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-06-01T00:00:00Z","Power":1094505.4,"EstimatedPower":1239985.6629106368,"Consumption":97751.6488368462,"Temperature":6.6,"Deviation":13.291872558201812,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":119,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-07-01T00:00:00Z","Power":766071.2,"EstimatedPower":1293214.0524931694,"Consumption":99903.100464741,"Temperature":16.0,"Deviation":68.811208735319823,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":120,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-08-01T00:00:00Z","Power":2048921.6,"EstimatedPower":1243607.6504395444,"Consumption":97391.090464741,"Temperature":9.5,"Deviation":-39.304283265911963,"Excluded":[3],"IsOutlier":true,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false}],[{"Id":66,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-02-01T00:00:00Z","Power":2375411.4,"EstimatedPower":2598429.5959766749,"Consumption":241303.937741935,"Temperature":-16.0,"Deviation":9.38861352507927,"Excluded":[4],"IsOutlier":true,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":67,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-03-01T00:00:00Z","Power":2816367.0,"EstimatedPower":2761899.1710119839,"Consumption":270116.242857143,"Temperature":-4.5,"Deviation":-1.9339748331100304,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":68,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-04-01T00:00:00Z","Power":2885174.8,"EstimatedPower":2951451.2435807148,"Consumption":283105.451152074,"Temperature":-9.9,"Deviation":2.2971378919819596,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":69,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-05-01T00:00:00Z","Power":3089902.2,"EstimatedPower":2900149.1745301066,"Consumption":283664.742857143,"Temperature":-4.7,"Deviation":-6.1410689784904378,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":70,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-06-01T00:00:00Z","Power":3227620.0,"EstimatedPower":2780273.3585052835,"Consumption":284044.431152074,"Temperature":6.6,"Deviation":-13.859953820298443,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":71,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-07-01T00:00:00Z","Power":2471207.0,"EstimatedPower":2790993.2908156421,"Consumption":295357.502857143,"Temperature":16.0,"Deviation":12.940489842236701,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false},{"Id":72,"CalculationMethod":"Потребление факт, кВт⋅ч","ProcessId":1,"Date":"2017-08-01T00:00:00Z","Power":2751209.6,"EstimatedPower":2848408.6166038075,"Consumption":293990.002857143,"Temperature":9.5,"Deviation":3.5329557080568286,"Excluded":[],"IsOutlier":false,"IsSelected":true,"IsNew":false,"IsModified":false,"IsDeleted":false}]
在json中,[{}]
表示数组,因此可以将其反序列化为例如列表。
{}表示单个对象,例如,可以将其反序列化为类表示。
一个音符
如果您想使用现有的json格式,则必须使用如下所示的列表列表
在这个网站上发布您的Json:http://pojo.sodhanalibrary.com并获得匹配的java pojo。
像上面一样,许多网站都可以在线将JSON直接转换为JavaPojo,如果您不确定您的模型,请使用其中之一。
问题内容: 这是我的课 最初的一个实际上需要转换为良好的json数据。这是最初的坏人 这是我的json数据,我无法反序列化。即使更改,我仍会收到默认值 我的自定义封面 问题答案: 您可以使用json.net以显示的格式对a进行反序列化和重新序列化,只要您使用custom即可。这是必需的,因为默认情况下,对象集合在JSON数组之间进行序列化,但是在JSON中,对象集合以单个对象的紧凑形式进行序列化,
问题内容: 我似乎无法使用BSON json_util反序列化我的MongoDB JSON文档。 json.loads函数使字符串阻塞。我了解json_util能够处理MongoDB的ObjectId格式并将其转换为可用的JSON。 Python代码: 我得到了解码器异常: 我想念什么吗? 问题答案: 我认为您的字符串形式实际上看起来像python表示形式… 对于实际的json字符串表示形式中存在
我从 REST API 获得以下 JSON 作为响应。 并尝试使用下面的代码进行解析,但这不会导致正确的反序列化类型。 下面是我在JSON响应中收到的字段的类。 缺少了什么?
问题内容: 我试图序列化和反序列化内部对象的数组列表: HairList对象也是一个可序列化的对象。 此代码执行返回以下错误: 排队 我不知道我在做什么错。你能给个小费吗? 更新: 解决: 仅使用HairBirt的本机数组而不是ArrayList即可工作: 代替 感谢大家的帮助。 问题答案: 不要使用-而是使用二进制数据并对它进行base64编码,以将其转换为字符串而不会丢失信息。 我强烈怀疑这是
我试图调用一个Spring Cloud Data Flow REST Endpoint,它应该返回一个任务的所有执行列表,该任务的名称在输入中传递。 首先,我在浏览器中运行了以下网址: 浏览器上显示了以下JSON: 接下来,我尝试通过Java调用同一个RESTendpoint;然而,无论我尝试什么,响应对象似乎都是空的,没有填充任何属性: 方法1:创建自定义域类来反序列化响应。(不工作。响应中收到