Forum - marc data in json

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #33973
    Anonymous
    Inactive

    I tried pulling bib data in JSON using the Alma API. However, when I looked at the embedded MARC in the “anies” field, it was encoded in XML! I thought it was very strange that the JSON has XML inside it. Especially when the documentation showed it as raw MARC. I double checked the documentation and noticed that half the time when you load the page it shows raw MARC in JSON and the other half it shows XML in the JSON: try for yourself: https://developers.exlibrisgroup.com/alma/apis/xsd/rest_bib.xsd?tags=GET

    Can someone explain this to me?

    Thanks,
    Joshua Gomez
    Getty Research Institute

    #35376
    Anonymous
    Inactive

    Dear Joshua,
    Although the documentation syntax-highlighter is not handling the XML within JSON well, your observation is correct – it is XML.
    We chose to display it this way because the format is called MARCXML, and because the data is saved as an XML String inside Alma. The underlying infrastructure which produces JSON according to the Accept header is handling xs:any fields this way, and we are not able to use a different field in the XSD because the structure of the Bib records might be different for UNIMARC, KORMARC etc.
    I hope you will be able to parse the XML although it’s wrapped in JSON, and if you have a suggestion for an improvement we are happy to hear,
    Ori

    #35377
    Anonymous
    Inactive

    Possibly what Joshua was expecting was to see the data from the MARC record converted into JSON format. This has been talked about for some years, e.g. see “A Proposal to serialize MARC in JSON”, http://dilettantes.code4lib.org/blog/2010/09/a-proposal-to-serialize-marc-in-json/

    Serving up a MARC (or MARCXML) record in a JSON wrapper is nowhere near as useful. Although I can sympathise with your explanation, you could justifiably restrict to the MARC21 standard.

    #35378
    Anonymous
    Inactive

    OK, I see that I did not look close enough at first. When the syntax highlighting failed, I thought I was looking at MARC in transmission format inside the JSON, but it was just MARCXML with the tags stripped out. I have no problem parsing the xml inside the json. I was just concerned that it would not be consistent. But now I see that it is just the documentation highlighter that was inconsistent, not the API.

    Thanks,
    Josh

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.