Interesting related videos


Friday, May 4, 2007

Jayrock JSON and JSON-RPC for .NET

Jayrock is a modest and an open source implementation of JSON and JSON-RPC for the Microsoft .NET Framework, including ASP.NET. What's so modest about it? Well, modest as in plain and basic and no work of genius.

A developer creates a helloworld.ashx that contains your server side logic:


namespace JayrockWeb
using System;
using System.Web;
using Jayrock.Json;
using Jayrock.JsonRpc;
using Jayrock.JsonRpc.Web;

public class HelloWorld : JsonRpcHandler
[ JsonRpcMethod("greetings") ]
public string Greetings()
return "Welcome to Jayrock!";

Then you can access the file asking for a proxy via helloworld.ashx?proxy and you will see a test page. From code you can now:


var s = new HelloWorld();

alert("sync:" + s.greetings());

s.greetings(function(response) {
alert("async:" + response.result) });