As promised long ago on #code4lib, I've created a couple modules for
dealing with MARC data in JSON; consider this a request for comments.
- MARC::Record::JSON is a perl module that monkey-patches MARC::Record to
provide a "as_json_record" method. This is essentially the same model used
to ouput XML from MARC::Record, and has the advantage that you don't have to
modify any existing code other than putting in an extra 'use
MARC::Record::JSON; at the top of your file after 'use MARC::Record;'.
- marcjson.js is a javascript library that make is not-too-awful to deal
with the resulting data in javascript. The interface is modeled after
MARC::Record in a very gross way, but has a stronger split between control
and data fields.
The MARC::Record::JSON data structure itself is *not* round-tripable (order
of subfields within a field is not preserved), but makes for an
easy-to-work-with format in read-only situations that one would probably be
encountering within a web page.
The whole thing, along with some documentation and a couple sample pages
that show off the javascript library, is on Google Code.
http://code.google.com/p/marc-json/
The samples of the JSON format at javascript code that pushes it around are
at:
http://code.google.com/p/marc-json/source/browse/trunk/samples/
Any -- and I do mean *any* -- comments would be much appreciated.
-Bill-
--
Bill Dueber
Library Systems Programmer
University of Michigan Library
|