APML2JSON Script/Service

This script takes an APML feed, and parses it into valid APML-JSON based on the APML-JSON spec on the APML wiki. Instead of manually parsing the APML into JSON, I have used the XSLT file attached to the aforementioned spec page along with xsltproc to generate the JSON data. The idea behind this script is based on John Resig’s RSS2JSON script.At the moment the script is pretty hacky for release, so I have provided a REST interface that can be accessed via a GET request.

A request to the interface would take the following form:

The callback parameter is optional. If specified, the resulting JSON is wrapped in the callback for easy parsing at the client end, otherwise the resulting JS Object is assigned to a variable which can be accessed via JS. The results from the call are cached hourly to reduce the load on the server. :)

Example Interface call: http://bmn.name/examples/apml2json/?

For more information on how to use the resulting JS, head over to John’s RSS2JSON page as he provides some sample JS.


As a member of the APML Google group, I’m constantly reading and keeping in touch with the APML developments. The latest development that sparked my interest was the need for a JSON equivalent of the APML standard which could be used as a more lightweight interchange format for more efficient web application implementations of the APML spec.

David Novakovic put his hand up to start working on the JSON-APML spec, and naturally, I decided to give him a hand. We decided to make the JSON-APML spec as close to the XML version as possible without the bloat of XML. You can read more about the spec proposed over at the JSON-APML Google Groups thread. Feel free to join the group and give your thoughts about the spec proposed.

Given this spec, I decided to do a quick working example of using the JSON-APML format. The example I created uses a service created by Paul Lamere over at Tastebroker. Paul’s script scrapes profile data from various websites, and returns a well-formed APML feed. My script uses these feeds as a base for conversion into the JSON-APML spec.

How it works:

The demo connects to a server with user and service information. The server then scrapes Paul’s APML feeds for a given user/service, parses the APML into JSON-APML and returns it to the browser. The browser then formats the data into a tag cloud using javascript.

Check the example of APML-JSON out.