Skip to content

Format Support

MRRC supports multiple serialization formats for MARC records. This page provides a comprehensive reference of all supported formats.

Format Matrix

Format Read Write Python Rust Notes
ISO 2709 Yes Yes Yes Yes Standard MARC binary interchange
JSON Yes Yes Yes Yes Generic JSON representation
MARCJSON Yes Yes Yes Yes LOC standard JSON-LD format
MARCXML Yes Yes Yes Yes MARC21 XML schema
CSV - Yes Yes Yes Tabular export
Dublin Core - Yes Yes Yes 15-element metadata
MODS Yes Yes Yes Yes Metadata Object Description Schema
BIBFRAME Yes Yes Yes Yes RDF/Linked Data (bidirectional)

All formats are available in both Python and Rust without feature flags.

CSV and Dublin Core are write-only (export). Both are lossy projections of a MARC record, so MRRC emits them but does not parse them back into MARC. If you need to turn CSV or Dublin Core into MARC, write a reader matched to your source data — see the per-format sections below for guidance.

Format Details

ISO 2709 (MARC Binary)

The standard interchange format for MARC records.

File extension: .mrc

Use cases:

  • Library system interchange (ILS, OCLC)
  • Z39.50 compatible systems
  • Maximum compatibility

Python:

from mrrc import MARCReader, MARCWriter

# Reading
for record in MARCReader("records.mrc"):
    print(record.title)

# Writing
with MARCWriter("output.mrc") as writer:
    writer.write(record)

Rust:

use mrrc::{MarcReader, MarcWriter, RecordHelpers};
use std::fs::File;

// Reading
let mut reader = MarcReader::new(File::open("records.mrc")?);
while let Some(record) = reader.read_record()? {
    println!("{:?}", record.title());
}

// Writing
let mut writer = MarcWriter::new(File::create("output.mrc")?);
writer.write_record(&record)?;

JSON

Generic JSON representation of MARC records.

Python:

json_str = record.to_json()
record = mrrc.json_to_record(json_str)

MARCJSON

Library of Congress standard JSON format for MARC.

Python:

marcjson_str = record.to_marcjson()

MARCXML

MARCXML representation following the MARC21 XML schema.

Python:

xml_str = record.to_xml()

# Parse a single record from MARCXML
record = mrrc.xml_to_record(xml_str)

# Parse a MARCXML collection (multiple records)
records = mrrc.xml_to_records(collection_xml_str)

CSV

Tabular export for spreadsheet applications.

Direction: write-only. CSV is a flat projection — one row per record, columns chosen by you — with no canonical mapping back to structured MARC, so MRRC emits CSV but does not read it. To build MARC from CSV, write a reader matched to your column layout.

Python:

csv_str = mrrc.record_to_csv(record)
csv_str = mrrc.records_to_csv(records)

Dublin Core

Simplified 15-element metadata schema.

Direction: write-only. The crosswalk to Dublin Core's 15 elements is lossy — MARC carries far more — so MRRC emits Dublin Core but does not read it back into MARC. To import harvested Dublin Core (for example from OAI-PMH), write a best-effort reader for your source records.

Python:

dc_xml = record.to_dublin_core()

MODS

Metadata Object Description Schema for detailed bibliographic metadata.

Python:

mods_xml = record.to_mods()

BIBFRAME

BIBFRAME 2.0 RDF output for linked data applications.

Python:

from mrrc import marc_to_bibframe, BibframeConfig, RdfFormat

config = BibframeConfig()
config.set_base_uri("http://example.org/")
rdf_graph = marc_to_bibframe(record, config)
turtle_str = rdf_graph.serialize("turtle")

See the BIBFRAME Conversion Guide for detailed usage.

See Also