Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

| Views: 4105
I've been using JSON-RPC quite a bit lately and I wanted to have a way of calling my service without writing any special proxy code or using additional libraries, so I've put together a GAE App that uses Twitter Bootstrap for the UI and the json2.js to parse the JSON that's received using the XMLHttpRequest object. It was so quick and easy and the results look quite good.

The whole interface consists of two sections:
  • Request input
  • Response output


The request portion requires the URL of the service and a JSON string for the JSON-RPC call. The response section shows the raw JSON-RPC response as well as breaking it down per object.

The JSON for both the response and request are parsed using json2.js, which attempts to use the built-in JSON object in the browser first, if that fails it uses the eval() method with some checks to make sure the JSON doesn't include any malicious code.

This is what the request part looks like:
guru1.png



This is the response part:
guru2.png


There is a bit of JavaScript used to invoke the JSON-RPC call using a POST with the XMLHttpRequest object and a bit of JavaScript to process the response and build the table that shows all of the response objects.

Overall it took just a few hours to make and this was with no experience of Bootstrap previously and very little JavaScript knowledge. I'm using GAE simply to host a JSP page (that could have just been normal HTML as there is no server side processing).

The app is free to use and is available here: http://gurujsonrpc.appspot.com.

-i

Have comments or feedback on what I wrote? Please share them below! Found this useful? Consider sending me a small tip.
comments powered by Disqus
Other posts you may like...