Skip to content

@rsinger /gist:511752
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
{
"_id" : ObjectId("4c5c5542124ba05b7c000001"),
"leader" : "00597cz a2200217n 4500",
"fields" : [
{
"001" : "6"
},
{
"005" : "19840322000000.0"
},
{
"008" : "821220n| acaaaaaa |a aaa "
},
{
"010" : {
"ind1" : " ",
"ind2" : " ",
"subfields" : [
{
"a" : "n 42000048 "
}
]
}
},
{
"035" : {
"ind1" : " ",
"ind2" : " ",
"subfields" : [
{
"a" : "(DLC)n 42000048"
}
]
}
},
{
"040" : {
"ind1" : " ",
"ind2" : " ",
"subfields" : [
{
"a" : "DLC"
},
{
"c" : "DLC"
}
]
}
},
{
"100" : {
"ind1" : "1",
"ind2" : "0",
"subfields" : [
{
"a" : "Asaka, Toshiki,"
},
{
"d" : "1934-"
},
{
"t" : "Hokuriku no kodai to chūsei"
}
]
}
},
{
"430" : {
"ind1" : " ",
"ind2" : "0",
"subfields" : [
{
"a" : "Hokuriku no kodai to chūsei"
}
]
}
},
{
"641" : {
"ind1" : " ",
"ind2" : " ",
"subfields" : [
{
"a" : "Projected in 3 v."
}
]
}
},
{
"642" : {
"ind1" : " ",
"ind2" : " ",
"subfields" : [
{
"a" : "2"
},
{
"5" : "DLC"
}
]
}
},
{
"643" : {
"ind1" : " ",
"ind2" : " ",
"subfields" : [
{
"a" : "Tokyo"
},
{
"b" : "Hōsei Daigaku Shuppankyoku"
}
]
}
},
{
"644" : {
"ind1" : " ",
"ind2" : " ",
"subfields" : [
{
"a" : "f"
},
{
"5" : "DLC"
}
]
}
},
{
"645" : {
"ind1" : " ",
"ind2" : " ",
"subfields" : [
{
"a" : "t"
},
{
"5" : "DLC"
}
]
}
},
{
"646" : {
"ind1" : " ",
"ind2" : " ",
"subfields" : [
{
"a" : "s"
},
{
"5" : "DLC"
}
]
}
},
{
"670" : {
"ind1" : " ",
"ind2" : " ",
"subfields" : [
{
"a" : "Asaka, Toshiki. Jishō Juei no nairanron josetsu. 1981."
}
]
}
},
{
"953" : {
"ind1" : " ",
"ind2" : " ",
"subfields" : [
{
"a" : "xx00"
}
]
}
}
]
}
@dbs

File_MARC JSON output:

{
"leader" : "01850 2200517 4500",
"fields" : [
{
"001" : "0000000044"
},
{
"003" : "EMILDA"
},
{
"008" : "980120s1998 fi j 000 0 swe"
},
{
"020" : {
"subfields" : [
{
"a" : "9515008808"
},
{
"c" : "FIM 72:00"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"035" : {
"subfields" : [
{
"9" : "9515008808"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"040" : {
"subfields" : [
{
"a" : "NB"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"042" : {
"subfields" : [
{
"9" : "NB"
},
{
"9" : "SEE"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"084" : {
"subfields" : [
{
"a" : "Hcd,u"
},
{
"2" : "kssb/6"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"084" : {
"subfields" : [
{
"5" : "NB"
},
{
"a" : "uHc"
},
{
"2" : "kssb"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"084" : {
"subfields" : [
{
"5" : "SEE"
},
{
"a" : "Hcf"
},
{
"2" : "kssb/6"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"084" : {
"subfields" : [
{
"5" : "Q"
},
{
"a" : "Hcd,uf"
},
{
"2" : "kssb/6"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"100" : {
"subfields" : [
{
"a" : "Jansson, Tove,"
},
{
"d" : "1914-2001"
}
],
"ind1" : "1",
"ind2" : "1"
}
},
{
"245" : {
"subfields" : [
{
"a" : "Det osynliga barnet och andra berättelser /"
},
{
"c" : "Tove Jansson"
}
],
"ind1" : "0",
"ind2" : "0"
}
},
{
"250" : {
"subfields" : [
{
"a" : "7. uppl."
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"260" : {
"subfields" : [
{
"a" : "Helsingfors :"
},
{
"b" : "Schildt,"
},
{
"c" : "1998 ;"
},
{
"e" : "(Falun :"
},
{
"f" : "Scandbook)"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"300" : {
"subfields" : [
{
"a" : "166, [4] s. :"
},
{
"b" : "ill. ;"
},
{
"c" : "21 cm"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"440" : {
"subfields" : [
{
"a" : "Mumin-biblioteket,"
},
{
"x" : "99-0698931-9"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"500" : {
"subfields" : [
{
"a" : "Originaluppl. 1962"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"599" : {
"subfields" : [
{
"a" : "Li: S"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"740" : {
"subfields" : [
{
"a" : "Det osynliga barnet"
}
],
"ind1" : "4",
"ind2" : "4"
}
},
{
"775" : {
"subfields" : [
{
"z" : "951-50-0385-7"
},
{
"w" : "9515003857"
},
{
"9" : "07"
}
],
"ind1" : "1",
"ind2" : "1"
}
},
{
"841" : {
"subfields" : [
{
"5" : "Li"
},
{
"a" : "xa"
},
{
"b" : "0201080u 0 4000uu |000000"
},
{
"e" : "1"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"841" : {
"subfields" : [
{
"5" : "SEE"
},
{
"a" : "xa"
},
{
"b" : "0201080u 0 4000uu |000000"
},
{
"e" : "1"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"841" : {
"subfields" : [
{
"5" : "L"
},
{
"a" : "xa"
},
{
"b" : "0201080u 0 4000uu |000000"
},
{
"e" : "1"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"841" : {
"subfields" : [
{
"5" : "NB"
},
{
"a" : "xa"
},
{
"b" : "0201080u 0 4000uu |000000"
},
{
"e" : "1"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"841" : {
"subfields" : [
{
"5" : "Q"
},
{
"a" : "xa"
},
{
"b" : "0201080u 0 4000uu |000000"
},
{
"e" : "1"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"841" : {
"subfields" : [
{
"5" : "S"
},
{
"a" : "xa"
},
{
"b" : "0201080u 0 4000uu |000000"
},
{
"e" : "1"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"852" : {
"subfields" : [
{
"5" : "NB"
},
{
"b" : "NB"
},
{
"c" : "NB98:12"
},
{
"h" : "plikt"
},
{
"j" : "R, 980520"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"852" : {
"subfields" : [
{
"5" : "Li"
},
{
"b" : "Li"
},
{
"c" : "CNB"
},
{
"h" : "h,u"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"852" : {
"subfields" : [
{
"5" : "SEE"
},
{
"b" : "SEE"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"852" : {
"subfields" : [
{
"5" : "Q"
},
{
"b" : "Q"
},
{
"j" : "98947"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"852" : {
"subfields" : [
{
"5" : "L"
},
{
"b" : "L"
},
{
"c" : "0100"
},
{
"h" : "98/"
},
{
"j" : "3043 H"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"852" : {
"subfields" : [
{
"5" : "S"
},
{
"b" : "S"
},
{
"h" : "Sv97"
},
{
"j" : "7235"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"900" : {
"subfields" : [
{
"a" : "Yanson, Tobe,"
},
{
"d" : "1914-2001"
},
{
"u" : "Jansson, Tove,"
},
{
"d" : "1914-2001"
}
],
"ind1" : "1",
"ind2" : "1"
}
},
{
"900" : {
"subfields" : [
{
"a" : "Janssonová, Tove,"
},
{
"d" : "1914-2001"
},
{
"u" : "Jansson, Tove,"
},
{
"d" : "1914-2001"
}
],
"ind1" : "1",
"ind2" : "1"
}
},
{
"900" : {
"subfields" : [
{
"a" : "Jansone, Tuve,"
},
{
"d" : "1914-2001"
},
{
"u" : "Jansson, Tove,"
},
{
"d" : "1914-2001"
}
],
"ind1" : "1",
"ind2" : "1"
}
},
{
"900" : {
"subfields" : [
{
"a" : "Janson, Tuve,"
},
{
"d" : "1914-2001"
},
{
"u" : "Jansson, Tove,"
},
{
"d" : "1914-2001"
}
],
"ind1" : "1",
"ind2" : "1"
}
},
{
"900" : {
"subfields" : [
{
"a" : "Jansson, Tuve,"
},
{
"d" : "1914-2001"
},
{
"u" : "Jansson, Tove,"
},
{
"d" : "1914-2001"
}
],
"ind1" : "1",
"ind2" : "1"
}
},
{
"900" : {
"subfields" : [
{
"a" : "Janssonova, Tove,"
},
{
"d" : "1914-2001"
},
{
"u" : "Jansson, Tove,"
},
{
"d" : "1914-2001"
}
],
"ind1" : "1",
"ind2" : "1"
}
},
{
"976" : {
"subfields" : [
{
"a" : "Hcd,u"
},
{
"b" : "Skönlitteratur"
}
],
"ind1" : " ",
"ind2" : " "
}
},
{
"005" : "20050204111518.0"
}
]
}

@rsinger
Owner

Awesome. So the question at this point is, is this useful? I mean, it works pretty well for MongoDB, but that's because it has sort of an XPath-y like syntax to query, like "fields.245.a"

However, this is more like:
fields[5]['245'][0]['a'][0]

which is WAY awkward. So my question is, if you need a DSL to do anything with it, is it worth it at all?

@dbs

Even if you went with a hash instead of an array of fields, throwing away round-tripping, you would still run into a problem with multiple fields of the same tag and multiple subfields with the same code:

fields.650[0]["a"][0]

Still gross.

But I think your original round-trippable JSON format is useful if you want to use a JSON->native mappings and use native iterators, etc, rather than having to go through the intermediary pain and additional sluggishness of a MARC or XML parsing library.

@rsinger
Owner

Agreed. MARC's going to suck any way you cut it.

This:
http://goessner.net/articles/JsonPath/
would make this a no-brainer, really.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.