我已将数据保存到JSON文件中,该文件包括 int,double,多维double数组。现在,我想反序列化此JSON文件,但遇到错误
其他信息:数组的反序列化不支持类型'System.Double'。
如何处理此错误?
这是我的反序列化代码(JSON文件存储在 Total_Data.json 中):
string Output_Alt = File.ReadAllText(@"Total_Data.json");
JavaScriptSerializer Ser1 = new JavaScriptSerializer();
JSON_DATA DATA = Ser1.Deserialize<JSON_DATA>(Output_Alt);
我的数据模型如下:
public class JSON_DATA
{
public int val_No_Items;
public int val_No_Models;
public int val_No_Suppliers;
public int val_No_Ordering;
public int val_No_Periods;
public int val_No_State;
public int val_No_Demand_Type;
public double[,] val_Sup;
public double[,] val_State;
public double[,,] val_Min;
public double[,,] val_Max;
public double[,,] val_Lead_Time;
public double[] val_Exchange;
public double[,] val_Alt;
public double[,] val_Prod;
public double[] val_VIP;
public double[,] val_Demand_kt;
public double[,] val_Guarantee_kt;
public double[,,] val_Historical_Demand;
public double[,,] val_Historical_Times;
public double[] val_Seasonality;
public double[,,,] val_Inv;
public double[,] val_Initial_inv;
public double[,] val_Pcost;
public double[] val_Pcost_Model;
public double[,,] val_Ocost;
public double[] val_Pi_1;
public double val_Pi_2;
public double val_Pi_3;
}