良好的.NET库来使用JSON数据的工作?良好、数据、工作、JSON

由网友(持刀战情场所)分享简介:我目前正在尝试 Json.NET ,它似乎运作良好。I am currently trying out Json.NET, and it seems to work well.任何其他好的JSON库.NET?Any other good JSON libraries for .NET?推荐答案Jayrock 运...

我目前正在尝试 Json.NET ,它似乎运作良好。

I am currently trying out Json.NET, and it seems to work well.

任何其他好的JSON库.NET?

Any other good JSON libraries for .NET?

推荐答案

Jayrock 运作良好,并透明地将你的对象和JSON对象提供他们有一个公共构造方法。它还创建脚本给你们,你们可以叫像Javascript类Web服务。

Jayrock works well and transparently turns your objects to and from JSON objects providing they have a public constructor. It also creates the script for you so you can just call your web service like a Javascript class.

public class Person
{
  public string Name { get;set;}
  public int Age { get;set; }

  public Person() { }
}

public class MyService : JsonRpcHandler
{
   [JsonRpcMethod("getBob")]
   public Person GetBob()
   {
       return new Person() { Name="Bob",Age=20};
   }
}

和Javascript的:

And the Javascript:

var service = new MyService();
var result = service.getBob();
alert(result.name); // JSON objects are camel-cased.
阅读全文

相关推荐

最新文章