New Technologies Problem - JSON

My boss signed a contract to work with an online service. Unfortunately, he did it before he let us weigh on it and they're not using our kind of technology. We've been studying furiously and trying to figure out how to work it.

It's a webservice using a technology called JSON (pronounced "Jason"), to talk to a RESTful API.

We've been working to come up to speed with the newer services technologies. We are a .NET shop, and we've gone to .NET 4.0. We built a simple service where we can get the towns in a zipcode using SOAP, then we translated it into JSON with no problem. We've built two other services with it just to make sure our infrastructure is right. We get an object back, and use Javascript and a JSON parser to get the values out of it. We've also done some AJAX, but the Javascript was much easier and cleaner.

However, when we try to use their service, we get many errors. The callback function in Javascript we're using to get past some cross-domain issues throws errors (only with their service) and there is some weirdness in their query string implementation. We've been pounding the pavement in Google and books, trying just about cockamamie thing we find for over two weeks.

Today, they broke the camel's back with the straw that their whole end of the service is Java, and they don't even test with any other interface methods. Also, he insists that the callback function that is a required parameter for a service to be called "RESTful" according to the documentation we found does not work and cannot. He has a work-around for the query string format issue that is Java-only and does weird things when we try it. We are not interested in trying to implement a full re-write to a Java front-end that he wants us to use.

Does anyone have any experience interfacing with webservices using JSON with a Javascript interface, or just JSON experience in general? If you need more information to answer my question, just PM me and I can give code snippets and what have you.

A RESTful API just uses HTTP GET/PUT/POST/DELETE to manipulate server-side records. Here's a decent summary I found via Google. REST has gotten really popular these days, and I personally think it's being used for things it shouldn't. It's great as an interface to a single database table but really little else. RPC methods like SOAP and JSON-RPC are much more flexible.

JSON is a data representation format (a bit like XML) which can be converted to Javascript objects automatically. I've done a ton of JSON protocol work on the server-side and prefer it to XML because it's much more succinct and because the contained data has a type (object, array, string, number, etc). Browser-side I suppose it depends on what you're doing, since XML has stylesheets and whatnot.

The language used is absolutely irrelevant for JSON, though as I said above it's handy for working with Javascript apps since the conversion to usable objects on the browser-side is automatic. Here's a sample JSON object:

{ "name": "momgamer", "isOnHerLastNerve": true, "projectedKillCount": 3, "hitList": ["some guy", "some other guy"], "someObject": { "fieldA": null } }

That's it. There are Java parsers, C parsers, etc.

I'm not a browser person so what I'd ask them for is a spec or sample query and issue the request via telnet. If it works, then try to reproduce that query in your app and attach a packet sniffer or proxy to your traffic on port 80 to see what's being sent and received.

I'd also see if you can find a technical contact at the company. The manager or sales guy you're talking to doesn't have the knowledge to really help you.