序列化并获取对象对象

时间:2013-08-27 18:38:38

标签: c# asp.net json webforms

我的查询中有一个对象,现在我想将其转换为字符串,并发送到我的json页面,但我得到[object object], [object object]

我的查询是:

using System.Web.Script.Serialization;

public partial class AjaxProcess : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SouthParsModel.SouthParsEntities db = new SouthParsModel.SouthParsEntities();
        JavaScriptSerializer js = new JavaScriptSerializer();
        string serText = "";

        int id = Convert.ToInt32(Request["get_subcategory_or_product_of_this"]);

        var CatList = from rows in db.Categories
                  where rows.parentid_FK == id
                  select new { rows.id, rows.name, Type = "category"};


Response.Write(serText);
Response.End();

1 个答案:

答案 0 :(得分:1)

您使用的是JSON.parse(stringhere);将序列化对象传递给页面时?