Skip to content

MARC in JSON Description

Király Péter edited this page Jun 20, 2019 · 5 revisions

A Proposal to serialize MARC in JSON

Note: to see the backstory and justification of this proposal, please see this blog post.

MARC-in-JSON is a proposed JSON schema for representing MARC records as JSON. It is the outgrowth of working with MARC data in MongoDB and is intended to be both a faithful representation of MARC as well as a logical and useful model to work natively in JSON-centric environments. Ideally, this serialization could eventually replace binary MARC as the default format. The round trip of a MARC-in-JSON record from MARC to JSON back to MARC is lossless and preserves field/subfield order.

An example MARC bibliographic record, represented as text:

LEADER 01471cjm a2200349 a 4500
001 5674874
005 20030305110405.0
007 sdubsmennmplu
008 930331s1963 nyuppn eng d
035 $9 (DLC) 93707283
906 $a 7 $b cbc $c copycat $d 4 $e ncip $f 19 $g y-soundrec
010 $a 93707283
028 02 $a CS 8786 $b Columbia
035 $a (OCoLC)13083787
040 $a OClU $c DLC $d DLC
041 0 $d eng $g eng
042 $a lccopycat
050 00 $a Columbia CS 8786
100 1 $a Dylan, Bob, $d 1941-
245 14 $a The freewheelin' Bob Dylan $h [sound recording].
260 $a [New York, N.Y.] : $b Columbia, $c [1963]
300 $a 1 sound disc : $b analog, 33 1/3 rpm, stereo. ; $c 12 in.
500 $a Songs.
511 0 $a The composer accompanying himself on the guitar ; in part with instrumental ensemble.
500 $a Program notes by Nat Hentoff on container.
505 0 $a Blowin' in the wind -- Girl from the north country -- Masters of war -- Down the highway -- Bob Dylan's blues -- A hard rain's a-gonna fall -- Don't think twice, it's all right -- Bob Dylan's dream -- Oxford town -- Talking World War III blues -- Corrina, Corrina -- Honey, just allow me one more chance -- I shall be free.
650 0 $a Popular music $y 1961-1970.
650 0 $a Blues (Music) $y 1961-1970.
856 41 $3 Preservation copy (limited access) $u http://hdl.loc.gov/loc.mbrsrs/lp0001.dyln
952 $a New
953 $a TA28
991 $b c-RecSound $h Columbia CS 8786 $w MUSIC

The same bibliographic record serialized as MARC-in-JSON would appear as follows (pretty-printed with whitespace and line breaks for readability):

{
"leader":"01471cjm a2200349 a 4500",
"fields":
[
    {
        "001":"5674874"
    },
    {
        "005":"20030305110405.0"
    },
    {
        "007":"sdubsmennmplu"
    },
    {
        "008":"930331s1963    nyuppn              eng d"
    },
    {
        "035":
        {
            "subfields":
            [
                {
                    "9":"(DLC)   93707283"
                }
            ],
            "ind1":" ",
            "ind2":" "
        }
    },
    {
        "906":
        {
            "subfields":
            [
                {
                    "a":"7"
                },
                {
                    "b":"cbc"
                },
                {
                    "c":"copycat"
                },
                {
                    "d":"4"
                },
                {
                    "e":"ncip"
                },
                {
                    "f":"19"
                },
                {
                    "g":"y-soundrec"
                }
            ],
            "ind1":" ",
            "ind2":" "
        }
    },
    {
        "010":
        {
            "subfields":
            [
                {
                    "a":"   93707283 "
                }
            ],
            "ind1":" ",
            "ind2":" "
        }
    },
    {
        "028":
        {
            "subfields":
            [
                {
                    "a":"CS 8786"
                },
                {
                    "b":"Columbia"
                }
            ],
            "ind1":"0",
            "ind2":"2"
        }
    },
    {
        "035":
        {
            "subfields":
            [
                {
                    "a":"(OCoLC)13083787"
                }
            ],
            "ind1":" ",
            "ind2":" "
        }
    },
    {
        "040":
        {
            "subfields":
            [
                {
                    "a":"OClU"
                },
                {
                    "c":"DLC"
                },
                {
                    "d":"DLC"
                }
            ],
            "ind1":" ",
            "ind2":" "
        }
    },
    {
        "041":
        {
            "subfields":
            [
                {
                    "d":"eng"
                },
                {
                    "g":"eng"
                }
            ],
            "ind1":"0",
            "ind2":" "
        }
    },
    {
        "042":
        {
            "subfields":
            [
                {
                    "a":"lccopycat"
                }
            ],
            "ind1":" ",
            "ind2":" "
        }
    },
    {
        "050":
        {
            "subfields":
            [
                {
                    "a":"Columbia CS 8786"
                }
            ],
            "ind1":"0",
            "ind2":"0"
        }
    },
    {
        "100":
        {
            "subfields":
            [
                {
                    "a":"Dylan,
                     Bob,
                    "
                },
                {
                    "d":"1941-"
                }
            ],
            "ind1":"1",
            "ind2":" "
        }
    },
    {
        "245":
        {
            "subfields":
            [
                {
                    "a":"The freewheelin' Bob Dylan"
                },
                {
                    "h":"
                    [
                        sound recording
                    ]
                    ."
                }
            ],
            "ind1":"1",
            "ind2":"4"
        }
    },
    {
        "260":
        {
            "subfields":
            [
                {
                    "a":"
                    [
                        New York,
                         N.Y.
                    ]
                     :"
                },
                {
                    "b":"Columbia,
                    "
                },
                {
                    "c":"
                    [
                        1963
                    ]
                    "
                }
            ],
            "ind1":" ",
            "ind2":" "
        }
    },
    {
        "300":
        {
            "subfields":
            [
                {
                    "a":"1 sound disc :"
                },
                {
                    "b":"analog,
                     33 1/3 rpm,
                     stereo. ;"
                },
                {
                    "c":"12 in."
                }
            ],
            "ind1":" ",
            "ind2":" "
        }
    },
    {
        "500":
        {
            "subfields":
            [
                {
                    "a":"Songs."
                }
            ],
            "ind1":" ",
            "ind2":" "
        }
    },
    {
        "511":
        {
            "subfields":
            [
                {
                    "a":"The composer accompanying himself on the guitar ; in part with instrumental ensemble."
                }
            ],
            "ind1":"0",
            "ind2":" "
        }
    },
    {
        "500":
        {
            "subfields":
            [
                {
                    "a":"Program notes by Nat Hentoff on container."
                }
            ],
            "ind1":" ",
            "ind2":" "
        }
    },
    {
        "505":
        {
            "subfields":
            [
                {
                    "a":"Blowin' in the wind -- Girl from the north country -- Masters of war -- Down the highway -- Bob Dylan's blues -- A hard rain's a-gonna fall -- Don't think twice,
                     it's all right -- Bob Dylan's dream -- Oxford town -- Talking World War III blues -- Corrina,
                     Corrina -- Honey, just allow me one more chance -- I shall be free."
                }
            ],
            "ind1":"0",
            "ind2":" "
        }
    },
    {
        "650":
        {
            "subfields":
            [
                {
                    "a":"Popular music"
                },
                {
                    "y":"1961-1970."
                }
            ],
            "ind1":" ",
            "ind2":"0"
        }
    },
    {
        "650":
        {
            "subfields":
            [
                {
                    "a":"Blues (Music)"
                },
                {
                    "y":"1961-1970."
                }
            ],
            "ind1":" ",
            "ind2":"0"
        }
    },
    {
        "856":
        {
            "subfields":
            [
                {
                    "3":"Preservation copy (limited access)"
                },
                {
                    "u":"http://hdl.loc.gov/loc.mbrsrs/lp0001.dyln"
                }
            ],
            "ind1":"4",
            "ind2":"1"
        }
    },
    {
        "952":
        {
            "subfields":
            [
                {
                    "a":"New"
                }
            ],
            "ind1":" ",
            "ind2":" "
        }
    },
    {
        "953":
        {
            "subfields":
            [
                {
                    "a":"TA28"
                }
            ],
            "ind1":" ",
            "ind2":" "
        }
    },
    {
        "991":
        {
            "subfields":
            [
                {
                    "b":"c-RecSound"
                },
                {
                    "h":"Columbia CS 8786"
                },
                {
                    "w":"MUSIC"
                }
            ],
            "ind1":" ",
            "ind2":" "
        }
    }
]
}

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in IETF RFC 2119.

MARC-in-JSON records MUST conform to the following JSON schema:

{
"description":"A MARC Record",
"type": "object",
"properties": {
    "leader": {
        "type": "string",
        "minLength": 24,
        "maxLength": 24
    },
    "fields": {
        "type": "array",
        "items": {
            "type":[
                {
                    "type": "object",
                    "description":"A MARC Control Field",
                    "additionalProperties":{
                        "type":"string"
                    }
                },
                {
                    "type": "object",
                    "additionalProperties":{
                        "type":"object",
                        "description":"A MARC Variable Field",
                        "properties":{
                            "ind1":{
                                "type":"string",
                                "minLength":1,
                                "maxLength":1
                            },
                            "ind2":{
                                "type":"string",
                                "minLength":1,
                                "maxLength":1
                            },
                            "subfields":{
                                "type":"array",
                                "items":{
                                    "type":"object",
                                    "description":"A MARC Subfield",
                                    "additionalProperties":{
                                        "type":"string"
                                    }
                                }
                            }
                        }
                    }
                }
                ]
            },
        "additionalProperties": false
    }
},
"additionalProperties": false
}

Download this schema.

MARC-in-JSON consists of four (4) object types:

Record objects

The base representation of the MARC record. It MUST be a JSON object with two properties:

  • leader, which MUST be a string, exactly 24 characters in length.
  • fields, an array which MUST only contain control field and variable field objects.

Record objects MAY be contained in a JSON array.

Control field objects

MARC control fields MUST be represented as a JSON object with a single key/value pair. The key MUST be a string conforming to a valid MARC field tag value (generally three alphanumeric characters). The value of the object MUST be a string.

Variable field objects

Variable fields MUST be represented as JSON objects with a single key/value pair. The key MUST be a string conforming to a valid MARC field tag value (generally three alphanumeric characters). The value of the object MUST be a JSON object with three properties:

  • ind1: a one (1) character string representing the 1st MARC field indicator
  • ind2: a one (1) character string representing the 2nd MARC field indicator
  • subfields: an array containing at least one subfield object

Subfield objects

MARC subfields MUST be represented as JSON objects with a single key/value pair. The key MUST be a string conforming to a valid MARC subfield code value (generally a single alphanumeric character). The value MUST be a string representing the value of the subfield. A subfield object MUST only appear in a variable field object subfields array.

The content of a MARC-in-JSON object MUST be UTF-8 encoded or UTF-8 escaped according to the JSON standard (RFC 4627). MARC-8, UTF-16 or UTF-32 SHALL NOT be permitted under MARC-in-JSON.