Forum - marc data in json
- This topic has 3 replies, 3 voices, and was last updated 8 years, 2 months ago by Anonymous.
- November 21, 2014 at 3:01 pm #33973AnonymousInactive
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?
Getty Research InstituteNovember 22, 2014 at 9:13 pm #35376AnonymousInactive
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,
OriNovember 24, 2014 at 5:52 am #35377AnonymousInactive
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.November 24, 2014 at 4:41 pm #35378AnonymousInactive
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.
- You must be logged in to reply to this topic.