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

NOTE: This article is 3 years or older so its information may no longer be relevant. Read on at your own discretion! Comments for this article have automatically been locked, refer to the FAQ for more details.
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

Skip down to comments...
Hope you found this post useful...

...so please read on! I love writing articles that provide beneficial information, tips and examples to my readers. All information on my blog is provided free of charge and I encourage you to share it as you wish. There is a small favour I ask in return however - engage in comments below, provide feedback, and if you see mistakes let me know.

If you want to show additional support and help me pay for web hosting and domain name registration, donations, no matter how small, are always welcome!

Use of any information contained in this blog post/article is subject to this disclaimer.
 
comments powered by Disqus
Other posts you may like...