Expand description
JSON serialization and deserialization of MARC records.
This module provides conversion between MARC records and a generic JSON representation. The JSON format is a simple, flat structure with fields as keys and values/subfields as objects.
§Examples
ⓘ
use mrrc::{Record, Field, Leader, json};
let mut record = Record::new(Leader::default());
let mut field = Field::new("245".to_string(), '1', '0');
field.add_subfield('a', "Title".to_string());
record.add_field(field);
let json = json::record_to_json(&record)?;
println!("{}", json);
let restored = json::json_to_record(&json)?;Functions§
- json_
to_ record - Convert JSON back to a MARC record.
- record_
to_ json - Convert a MARC record to JSON.