上代码://对象转换json格式
 function _SealInfo() {
     var obj = new Object();
     obj.SAssessID = "-1";
     obj.SUserID = "-1";
     obj.DAddTime = "1900-01-01";
     obj.SAssessName =escape(projectName);
     obj.FCollectingArea = lab_fBuildArea;
     obj.FPlanningArea = SumArea;
     obj.SPlotRatio = escape(rjl);
     obj.SConforming = escape(Conforming);
     obj.SConformingID = escape(sConformingID);
     obj.SProvince = escape(sProvince);
     obj.SCity = escape(sCity);
     obj.IParcelArea = CityCode;
     obj.FAssessPrice_Market = fAssessPrice_Market;
     obj.FTotalPrice_Market = fTotalPrice_Market;
     obj.FAssessPrice_Assume = fAssessPrice_Assume;
     obj.FTotalPrice_Assume = fTotalPrice_Assume;     //判断
     obj.IDistance_Markey = iDistance;
     obj.ITimelimit_Markey = iTimelimit;
     obj.IDistance_Assume = iDistance;
     obj.ITimelimit_Assume = iTimelimit;     obj.IItemCount_Markey = arr1.length;
     
     obj.IItemCount_Assume = arr2.length;
     //假设开发法参数
     obj.FExpenseRatio = -1;
     obj.FMargin =-1;
     obj.FCosts = -1;
     obj.FIncrease = -1;
     obj.IState = State;
     return $.toJSON(obj);
 }
 function UrlAjax(type) {
     var infoJson = _SealInfo();
     $.post("Agent/LandAssessDBdetail.ashx", { AssessAjaxtype: type, info: infoJson }, function(msg) { 
        
     })
后台ashxJavaScriptSerializer js =new JavaScriptSerializer();
            LandAssess_BasicInfoClass info = js.Deserialize<LandAssess_BasicInfoClass>(context.Server.HtmlDecode(context.Request.Form["info"]));后台接收转成对象了但是还是编码的数据。求解

解决方案 »

  1.   

    obj.SAssessName =escape(projectName);
    是何种用意呢?规避汉字乱码?
      

  2.   

    用DataContractJsonSerializer 的实例化对象里面的ReadObject方法试试
      

  3.   

      //将Json字符串转化成对象         
    DataContractJsonSerializer outDs = new DataContractJsonSerializer(typeof(LandAssess_BasicInfoClass));         
    using (MemoryStream outMs = new MemoryStream(Encoding.UTF8.GetBytes(context.Request.Form["info"])))         
    {            
     LandAssess_BasicInfoClass  info = outDs.ReadObject(outMs) as LandAssess_BasicInfoClass; 
      

  4.   

    印象中J2EE环境下才有GET参数传汉字乱码的问题
    如果是这样,你可以试试自定义序列化器
    需要解码的字段解一下就好了