簡體   English   中英

序列化並獲取對象

[英]serialize and get object object

我的查詢中有一個對象,現在我想將其轉換為字符串,然后發送到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();

您是否正在使用JSON.parse(stringhere); 當您將序列化的對象傳遞給頁面時?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM