zoukankan      html  css  js  c++  java
  • 后台反序列化前台传的JSON数据

    using (var stream = Request.InputStream)
                {
                    string inputStream = new StreamReader(stream).ReadToEnd();
                    
                    JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
                    scheduleEventEntity = jsSerializer.Deserialize<ScheduleEventEntity>(inputStream);
                }
     
                foreach (PropertyDescriptor descriptor inTypeDescriptor.GetProperties(scheduleEventEntity))
                {
                    string name = descriptor.Name;
                    object value;
                    if (descriptor.PropertyType == typeof(String))
                    {
                        value =Microsoft.JScript.GlobalObject.unescape(descriptor.GetValue(scheduleEventEntity));
                    }
                    else
                    {
                        value = descriptor.GetValue(scheduleEventEntity);
                    }
                    if (value.ToString() == "undefined")
                    {
                        value = string.Empty;
                    }
                    descriptor.SetValue(scheduleEventEntityvalue);
                }
     
  • 相关阅读:
    自绘标题栏
    显示驱动相关 -- DrvEscape和ExtEscape
    Delphi 直接打印代码(不需要装打印机驱动)
    在TCanvas上画背景透明的矩形
    写作套路中的立功,立言,立德
    python入门(Python和Pycharm安装)
    delphi CxGrid用法总结(63问)
    如何安装inf类型驱动程序 inno
    PHP-SQL Server
    Exchange Tech Issues 参考网站
  • 原文地址:https://www.cnblogs.com/Amity/p/2977768.html
Copyright © 2011-2022 走看看