C# 自定义数组加反序列化

  //实例1
   string[] job = new string[] { "1", "2", "3", "5",  };
   
   //实例2
   var warntypeData = "[{\"id\":\"1\",\"fullName\":\"嘻嘻\"},{\"id\":\"2\",\"fullName\":\"哈哈\"}]".ToObject<List<StaticDataModel>>();
   //自定义序列化
   var list = JsonConvert.DeserializeObject<List<Customer>>(strJson.Currentstep);
   
   public class StaticDataModel
	{
		/// <summary>
		/// 选项名称.
		/// </summary>
		public string fullName { get; set; }

		/// <summary>
		/// 选项值.
		/// </summary>
		public string id { get; set; }

		/// <summary>
		/// 子级.
		/// </summary>
		public List<StaticDataModel> children { get; set; }
	}
posted @ 2025-01-31 13:32  程序员小王YN  阅读(13)  评论(0)    收藏  举报