inicio mail me! sindicaci;ón

Archive for July, 2006

JSON, GDownloadUrl & Windows 2003 Server

I found out the hard way that JSON files are not a recognized mime type by Windows 2003 Server (IIS 6.0), where references to those same files on XP Pro (IIS 5.1) renders just fine. I came across this bug when doing customizations to the Google Map API, rendering area maps using the GDowloadUrl (Using XML and Asynchronous HTTP with Maps) and the light-weight JSON files. Anytime I parsed through the JSON file and called GDowloadUrl, I would get a file not found error. Sure enough, pasting the complete URL to the JSON file into FF, resulted in File not found…error…error….

The solution was straight-forward enough. Open IIS Manager and under the HTTP Headers tab > MIME Types, add the custom .json and restart IIS.
Adding a new mime type

The JSON format, if you haven’t used it, is a light-weight technology indepenedant data-interchange format that uses conventions found in languages including C, C++, C#, Java, JavaScript, Perl, Python, and many others. If you’re familiar with XML, JSON is just as structured and human-readable, well as readable as it can be. Check out the JSON website for documentation and examples.

An area where you’ll see more and more people using the JSON format is AJAX, specifically to speed-up calls back and forth from the server. A good article to get you started is Speeding Up AJAX with JSON.