Re: MARC-in-JSON in MARC::Record
[email protected] (Brad Baxter) Tue, 18 Jan 2011 09:14:47 -0500
| Newsgroups | perl.perl4lib |
|---|---|
| Message-ID | <[email protected]> |
When I wrote Data::Pairs (http://search.cpan.org/dist/Data-Pairs/), I had
JSONified MARC in mind. To my mind, a data structure that is a "Pairs
of Pairs"[2] would faithfully represent a MARC record, including preserving
the orders of fields/subfields.
Below is the short example from [1] displayed as a Pairs of Pairs in
JSON. In Data::Pairs, I wanted to see what the algorithms might be
for setting and getting data from such a structure, with the intention
that those algorithms might be the basis for a similar JSON library.
So my real world situation isn't that I've used any MARC in JSON to
date, but I did begin writing code with that intention. :-)
Appearing after the JSON example below is the same data displayed
as YAML. By taking the Pairs of Pairs approach, I had envisioned that
presenting the YAML version to a human might facilitate manual edits.
I guess I'm late in the game suggesting another proposal, but there it
is. Writing a schema for this might be tricky, but as a data structure
it's fairly simple and self-consistent.
Regards,
Brad
[1] http://robotlibrarian.billdueber.com/new-interest-in-marc-hash-json/
[2] http://yaml.org/type/pairs.html
JSON:
[
{ "leader" : "leader string" },
{ "001" : "001 value" },
{ "002" : "002 value" },
{ "010" :
[
{ "ind1": " " },
{ "ind2": " " },
{ "a" : "68009499" }
]
}
{ "035" :
[
{ "ind1": " " },
{ "ind2": " " },
{ "a" : "(RLIN)MIUG0000733-B" },
]
}
{ "035" :
[
{ "ind1": " " },
{ "ind2": " " },
{ "a" : "(CaOTULAS)159818014" },
]
}
{ "245" :
[
{ "ind1": "1" },
{ "ind2": "0" },
{ "a" : "Capitalism, primitive and modern;" },
{ "b" : "some aspects of Tolai economic growth" },
{ "c" : "[by] T. Scarlett Epstein." }
]
}
]
YAML:
- leader: "leader string"
- 001: "001 value"
- 002: "002 value"
- 010:
- ind1: " "
- ind2: " "
- a: "68009499:
- 035:
- ind1: " "
- ind2: " "
- a: "(RLIN)MIUG0000733-B"
- 035:
- ind1: " "
- ind2: " "
- a: "(CaOTULAS)159818014"
- 245:
- ind1: "1"
- ind2: "0"
- a: "Capitalism, primitive and modern;"
- b: "some aspects of Tolai economic growth"
- c: "[by] T. Scarlett Epstein."