If you do any so-called AJAX development, you may be familiar with [JSON][1]. This terse “object notation” lets you turn just about any set of data into a compact plain-text string that can easlily be shuttled across the network or from one program to another. Most AJAX libraries have built in support for JSON. We’ve just posted the [FileMaker to JSON Converter][2], an XSLT template that adds direct-to-JSON support to FileMaker Server Advanced. With this little beauty installed, dynamic web applications, ruby scripts, dashboard widgets, and gadgets can talk direclty to FileMaker with ease.
[1]:http://en.wikipedia.org/wiki/Json
[2]:http://www.sixfriedrice.com/wp/products/filemaker-to-json-converter/
## The Inspiration
A few weeks ago I had need to write a Dashboard Widget that communicated with FileMaker. Of course FileMaker has a very powerful XML interface (by way of the Web Publishing Engine in FileMaker Server Advanced) and Javascript is perfectly capable of parsing XML. But I’ve never been a fan of this sort of approach for a couple of reasons:
1. XML is a pretty heavy-weight format for simple data exchange. If it is being compressed, the problem is largely mitigated, but most web servers aren’t configured to compress HTTP data in-transit. And FileMaker’s XML is particularly large since it includes so much ancillary information (and all the tags that go along with it). I wanted a more svelte means of retrieving data.
2. Parsing XML in Javascript is a nuisance. It isn’t _hard_ per se, but it is tedious. I like to avoid it at all costs.
JSON overcomes both these concerns: it is very light weight, and it is simple to handle in Javascript. So I built an XSLT stylesheet to let FileMaker serve up JSON directly.
Without further ado, we’re pleased to make [the FileMaker to JSON Converter][2] available free of charge. This XSLT stylesheet adds direct-to-json support to you FileMaker Web Publishing setup. It is really cool.
The download, and complete documentation can be found [here][2].
Let us know what you think 🙂
It appears that the generated JSON code won’t validate – it is using single quotes to enclose strings where JSON requires double quotes.