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

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

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.