On Wed 25 Apr 2007, Chris Prather chris@prather.org wrote:
There is JSON::Any which (attempts) to normalize the APIs of the half dozen JSON modules on CPAN.
Hm, I'm trying to work out if that would actually help us or not - I can see it would definitely help if we added a JSON dependency, but I was thinking along the lines of only sending out JSON output if we could find a JSON module. I suppose we could refuse to do JSON unless JSON::Any was installed... that might be the best bet.
*cough* and patches in Trac that I think implement this for a sufficiently old version of OG.
I think that assuming we use JSON::Any, the hard part is not going to be actually implementing this, but deciding what should go into the JSON output for each thing - e.g. the node output from my previous mail - what's useful/relevant? There should also be JSON output for categories and locales, listing everything in that category/locale. The main question, I think, is how much info we put into each mouthful of output; for example, the output for "Category Pubs" could be as simple as a list of format=json URLs; someone wanting more info could then fetch each URL individually and get the data from there - but that's a lot of hits on the webserver. We might be able to avoid some of those hits by returning more info in the Category Pubs JSON object, for example the name of the node, the other categories that it's in, its lat/long, its locales. This would be at the expense of more database activity on the original request.
</braindump>
Kake