A Proposal to serialize MARC in JSON

Note: to see the backstory and justification of this proposal, please see the preceding 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.

There are currently two implementations conforming to this specification for serialization:

45 comments
  1. Should we think about transforming the leader? Record length is meaningless in this context — maybe make it all zeros?

    Also, the spec requires utf-8, so maybe the encoding char in the leader should be forced to ‘a’ within marc-in-json.

  2. Also — what to do about serializing multiple records in a collection? Requiring a json pull-parser might be more a challenge in some language than others.

    One (perfectly valid) option is to ignore it, and explicitly state that this is a single-record serialization.

  3. Ross said:

    I have no problem with the record length suggestion. What does marcxml do? I figure copying its behavior makes the most sense.

    I’m not sure, however, with forcing the encoding char to ‘a’. Just because JSON requires UTF-8, it doesn’t mean the record wasn’t inadvertently serialized from a MARC-8 record. At least a valid leader would signal some ‘buyer beware’ actions need to be taken on the part of consumer.

    As far as single vs. multiple objects in the collection, I say this work just like marcxml: if the first character is a “[” it’s a collection, if it’s a “{“, it’s a single record. It’s hard to justify newline delimited JSON until there is some standardized way to advertise it.

    I agree that requiring a pull-parser is less than ideal (and it wouldn’t be ‘required’, just ‘recommended’), but given a selection of sub-par alternatives (pull-parser vs. non-standard), I feel compelled to go with the thing we can advertise and consistently document.

    Now, if ways to provide newline-delimited JSON were to improve, then I’m all for it. Also, this says nothing about any out of band arrangements you might have.

  4. Robin said:

    The sample here changes the semantics of the MARC a little bit, though I suspect that it’s just the source formatting doing it.

    E.g. the $a on:

    260 $a [New York, N.Y.] : $b Columbia, $c [1963]

    becomes:

    “a”:”
    [
    New York,
    N.Y.
    ]
    :”

    introducing newlines where they shouldn’t be (not that they should be in MARC anyway, but that doesn’t mean they don’t happen sometimes…)

  5. Thanks for the good writeup. It in fact was once a leisure
    account it. Look complex to far brought agreeable from you!
    By the way, how could we keep up a correspondence?

    my site; customized fat loss review [Theodore]

  6. I quite like looking through a post that will make people think.
    Also, thank you for permitting me to comment!

    my blog post – metabolic cookbooks

  7. Useful information. Fortunate me I discovered your site accidentally, and I’m shocked why this twist of fate did not happened in advance!
    I bookmarked it.

    Also visit my web-site: cruise control diet pdf

  8. Your style is so unique in comparison to other folks I’ve read
    stuff from. Thanks for posting when you’ve got the opportunity,
    Guess I’ll just book mark this blog.

    Feel free to surf to my web blog … old school new
    body does it work (Cristine)

  9. Greetings from Idaho! I’m bored to death at work so I
    decided to check out your website on my iphone during lunch break.
    I really like the knowledge you present here and can’t wait to
    take a look when I get home. I’m shocked at how fast your blog loaded on my phone ..
    I’m not even using WIFI, just 3G .. Anyhow, fantastic blog!

    My web site :: teds woodworking scam

  10. Gaye said:

    That is really interesting, You are an excessively skilled blogger.

    I’ve joined your feed and stay up for searching for extra of your magnificent post.
    Also, I’ve shared your web site in my social networks

    my homepage – boost your bust reviews, Gaye,

  11. For example, you will have photos of dresses, cakes, centerpieces and many more.
    The IIS is essentially your web server that comes inbuilt with all Windows PCs.
    As seen previously, the Canada Nintendo Examiner has received a Nintendo 3DS and three titles
    for it.

  12. Greate post. Keep writing such kind of info
    on your page. Im really impressed by your site.

    Hey there, You’ve performed a great job. I will certainly digg
    it and in my view suggest to my friends. I am sure they’ll be benefited
    from this web site.

    Here is my homepage: pre-mature ejecuation

  13. Its like you read my mind! You seem to know a lot about this,
    like you wrote the book in it or something. I
    think that you can do with some pics to drive the message home a bit,
    but instead of that, this is great blog. A fantastic read.
    I will certainly be back.

    Take a look at my blog :: Make Him Desire You Scam
    (http://www.octoopus.com/vise09suede)

  14. conversation, or perhaps he might have joined me at the root cause and
    understood. The symbol marking or possibly a fraction near to the start of the
    staff is termed as a time signature. Debbie and David analyzed suddenly every time a trumpet sounded with
    the open window.

  15. Joe said:

    Admiring the persistence you put into your
    website and in depth information you provide. It’s great to come across a blog every once in a while that isn’t the same
    outdated rehashed information. Wonderful read!

    I’ve saved your site and I’m including your RSS feeds to my Google account.

    Here is my web blog :: how old to start potty training
    (Joe)

  16. Good day! Would you mind if I share your blog with
    my twitter group? There’s a lot of folks that I
    think would really appreciate your content.

    Please let me know. Many thanks

    my page; premature Ejaculation

  17. This is a fantastic web site, could you be eager in doing an interview regarding just how you created it?
    If so e-mail me!

    Feel free to visit my homepage; how to get rid of acne scars fast [kiyokogregory1960632.pen.io]

  18. Nice post. I learn something totally new and challenging on websites I stumbleupon everyday.
    It will always be useful to read content from other writers and use something from other websites.

    Here is my homepage :: seo experts (http://www.spotbuz.com)

  19. Carbohydrates include the fuel your body will burn when you work out, and
    you also want something that will sustain you throughout your bodybuilding session. Market for Wellness Programs and Their Impact on Pharmaceutical, Diagnostic and Device
    Product Markets -. When you age on the muscles become weak or their tissues start deteriorating (atrophy).

  20. What’s up to every body, it’s my first go to see of this
    blog; this weblog carries remarkable andd genuinely fine information designed for
    readers.

    Feell free to visit my web site zynga poker astuce triche

  21. If you would like to take a great deal from this post then you have to apply these
    strategies to your won website.

    Here is my website … want your man back

  22. Karissa said:

    Greate post. Keep posting such kind of information on your page.
    Im really impressed by your blog.
    Hey there, You’ve performed an excellent job. I will certainly digg it and
    for my part suggest to my friends. I’m confident they’ll be benefited from this site.

    my site :: web site (Karissa)

  23. Magda said:

    Heya! I’m at work surfing around your blog from my
    new iphone 3gs! Just wanted to say I love
    reading through your blog and look forward to all your posts!
    Keep up the great work!

    Feel free to surf to my website … sold out after crisis reviews (Magda)

  24. Hayden said:

    Pretty great post. I just stumbled upon your weblog and wished
    to say that I’ve really enjoyed browsing your
    blog posts. After all I’ll be subscribing for your feed and I hope you write again very soon!

    My page: Tips to remove papules (Hayden)

  25. Thalia said:

    I was wondering if you ever thought of changing the page layout of your blog?
    Its very well written; I love what youve got to say.

    But maybe you could a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having one or two pictures.

    Maybe you could space it out better?

    Here is my weblog: text your ex back pdf (Thalia)

  26. This page truly has all of the information and facts I needed
    concerning this subject and didn’t know who to ask.

    Feel free to visit my weblog; dog food diet

  27. Hi there colleagues, how is all, and what you desire to say regarding this piece of
    writing, in my view its really amazing for me.

    Here is my website what men secretly want reviews (Matthias)

  28. We absolutely love your blog and find a lot
    of your post’s to be exactly what I’m looking for. can you offer guest writers
    to write content for you? I wouldn’t mind writing a post or elaborating on some of the subjects you write regarding here.
    Again, awesome web site!

    Look into my site; Penis Advantage reviews (http://www.edutorium.org)

  29. Howdy! I know this is kinda off topic however , I’d
    figured I’d ask. Would you be interested in exchanging
    links or maybe guest authoring a blog post or vice-versa?
    My blog discusses a lot of the same subjects as yours and I believe we could greatly benefit from each other.
    If you’re interested feel free to shoot me an e-mail. I look forward
    to hearing from you! Superb blog by the way!

    my site what is paleo food

  30. My partner and I absolutely love your blog and find many of your post’s to be exactly I’m looking for.
    Do you offer guest writers to write content to suit your needs?
    I wouldn’t mind writing a post or elaborating on some of the subjects you write in relation to here.
    Again, awesome weblog!

  31. Hello, all the time i used to check blog posts here early in the break
    of day, for the reason that i enjoy to find out more and more.

    Look at my blog post anxiety and depression

  32. I think that what you posted was actually very logical.
    However, what about this? what if you added a little content?
    I mean, I don’t wish to tell you how to run your website,
    but suppose you added a title that grabbed folk’s
    attention? I mean A Proposal to serialize MARC in JSON Dilettante’s Ball is kinda
    plain. You might look at Yahoo’s home page and see how they create post headlines to
    grab people interested. You might add a video or a picture or two to grab readers interested about everything’ve written. Just my opinion, it would make your blog
    a little bit more interesting.

    My web site; what men want

  33. I do not know whether it’s just me or if everyone else experiencing problems with
    your website. It appears as if some of the written text on your content are running off the screen. Can somebody else
    please comment and let me know if this is happening to them too?
    This might be a problem with my internet browser because I’ve had this happen previously.
    Many thanks

    Take a look at my webpage :: yeast infection medication (jimdo.com)

  34. Thanks , I’ve just been looking for information approximately this
    subject for ages and yours is the greatest I have found out so far.
    However, what in regards to the bottom line? Are you sure about the supply?

    My web blog … Renegade Diet Food

  35. Hello Dear, are you genuinely visiting this web page daily, if so
    after that you will absolutely get pleasant know-how.

    Feel free to visit my blog post: Jes Extender

  36. Google said:

    No one routes for the evil villan who’s run off with the hero’s
    beau, same applies to a site that’s been stuck in Google‘s naughty corner.
    The website speed test at Secret Search Engine Labs will analyze how fast
    a page on your site is loading and give you tips on how to improve it.
    * Page SEO: Your page is optimized by various means which include, choosing the right keywords, placing them right, adding anchor text linking, adding call to
    action in various places on the page.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>