相关疑难解决方法(0)

在Android中将对象转换为JSON

有没有一种简单的方法可以将任何对象转换为Android中的JSON?

java rest android json

115
推荐指数
4
解决办法
13万
查看次数

通过http GET将JSON对象发送到服务器

我正在寻找通过GET将JSON对象发送到服务器.Chris 通过JSON将对象数组发布到ASP.Net MVC3的答案适用于http POST,但不适用于GET.我的情况也适用于POST但不适用于GET.我可以做些什么让GET工作这是我的情况:在Controller中我有以下方法public ActionResult Screenreport(Screentable screendata)

   {
       // do something here
       return View();
   }
Run Code Online (Sandbox Code Playgroud)

我有两个ModelView如下:

   public class Screenrecord
   {
      public string Firstname{ get; set; }
      public string Lastname{ get; set; }
   }
   public class Screentable
   {
      public List<Screenrecord> Screenlist { get; set; } 
   }
Run Code Online (Sandbox Code Playgroud)

在客户端,我生成JSON对象

var Screentable = { Screenlist: screendata };
Run Code Online (Sandbox Code Playgroud)

screendata是一个Screenrecord数组

所有这些工作当我使用POST,但当我使用GET时,我得到空值(screendata = null)控制器的方法.换句话说,当单击GO时,屏幕截图(Screentable screendata)例程中的screendata为null.

此外,如果我发送一个JSON对象它可以工作,但如果我发送像我描述的数组(列表),它不会.我想做的是可行的吗?

json asp.net-mvc-3

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

json ×2

android ×1

asp.net-mvc-3 ×1

java ×1

rest ×1