Usually at the routine returns JSON data

Usually at the routine returns JSON data

1、var JsonDate = new
            {
                code = 0,
                count = ds.Tables[0].Rows.Count,
                data = ds.Tables[0],
            };

string json = JsonConvert.SerializeObject(obj);
context.Response.ContentType = "text/json";
context.Response.Write(json);

2、JObject jobject = new JObject();

jobject.Add("Code", 0);
jobject.Add("Msg", "修改成功");

context.Response.ContentType = "text/json";
context.Response.Write(jobject.ToString().Replace("\r\n", "").Replace(" ", ""));

Guess you like

Origin www.cnblogs.com/mmArvin/p/11854475.html