citeproc-hs and json

“Bruce D’Arcus” <@Bruce_D_Arcus1> writes:

Andrea,

If you refer to pandoc/citeproc in general, I use bibtex and json,
handwritten, for input and darcs for revisions.

I’m having issues getting the json to work. Shouldn’t the following
example be OK?

{
“book” : {
“title”: “some title”
},
“article” : {
“title”: “some title”,
“container-title”: “some title”,
“volume”: “some title”,
“issue”: “some title”,
“pages”: “some title”,
“doi”: “some title”
}
}

You need to use an object or an array. This should work:

[

{
    "title": "some title",
    "type": "book",
    "id": "ITEM-2"
},
{
	"id": "ITEM-1",
    "title": "some title",
    "container-title": "some title",
    "volume": "some title",
    "issue": "some title",
    "pages": "some title",
    "doi": "some title",
    "type": "article"
}

]

(I also added the ‘id’ field, needed if you want to use it).

There should be an example of the object format in the test-suite…
citeproc-hs reads the JSON you may find in the test-suite, basically.

Andrea

Just going back to this …On Mon, Feb 14, 2011 at 6:48 PM, andrea rossato <@Andrea_Rossato1> wrote:

“Bruce D’Arcus” <@Bruce_D_Arcus1> writes:

Andrea,

On Thu, Feb 10, 2011 at 3:08 PM, Andrea Rossato >> <@Andrea_Rossato1> wrote:

If you refer to pandoc/citeproc in general, I use bibtex and json,
handwritten, for input and darcs for revisions.

I’m having issues getting the json to work. Shouldn’t the following
example be OK?

{
“book” : {
“title”: “some title”
},
“article” : {
“title”: “some title”,
“container-title”: “some title”,
“volume”: “some title”,
“issue”: “some title”,
“pages”: “some title”,
“doi”: “some title”
}
}

You need to use an object or an array. This should work:

[

{
“title”: “some title”,
“type”: “book”,
“id”: “ITEM-2”
},
{
“id”: “ITEM-1”,
“title”: “some title”,
“container-title”: “some title”,
“volume”: “some title”,
“issue”: “some title”,
“pages”: “some title”,
“doi”: “some title”,
“type”: “article”
}
]

(I also added the ‘id’ field, needed if you want to use it).

Not a big deal; just asking for possible future consideration:

Isn’t it more sensible as a general proposition to encode the json as
a key-value hash/dictionary (as I have up top) rather than an array?

Bruce

“Bruce D’Arcus” <@Bruce_D_Arcus1> writes:

Just going back to this …

“Bruce D’Arcus” <@Bruce_D_Arcus1> writes:

Andrea,

If you refer to pandoc/citeproc in general, I use bibtex and json,
handwritten, for input and darcs for revisions.

I’m having issues getting the json to work. Shouldn’t the following
example be OK?

{
“book” : {
“title”: “some title”
},
“article” : {
“title”: “some title”,
“container-title”: “some title”,
“volume”: “some title”,
“issue”: “some title”,
“pages”: “some title”,
“doi”: “some title”
}
}

You need to use an object or an array. This should work:

[

{
“title”: “some title”,
“type”: “book”,
“id”: “ITEM-2”
},
{
“id”: “ITEM-1”,
“title”: “some title”,
“container-title”: “some title”,
“volume”: “some title”,
“issue”: “some title”,
“pages”: “some title”,
“doi”: “some title”,
“type”: “article”
}
]

(I also added the ‘id’ field, needed if you want to use it).

Not a big deal; just asking for possible future consideration:

Isn’t it more sensible as a general proposition to encode the json as
a key-value hash/dictionary (as I have up top) rather than an array?

If I understand you correctly, citeproc-hs already does something like
what you seems to be asking for. That is to say, it handles both the
type of array which is used in the test suite – the example I proposed
above --, and an object type like the one that follows below.

As I said I used the examples I found around in the csl related
repositories when coding citeproc-hs. Is the example you proposed
something Frank’s citeproc-js can read? Is it another serialization
proposal? I’m asking because maybe I’m not getting the point.

Andrea

ps: The object example:

{
“ITEM-1”: {
“id”: “ITEM-1”,
“title”:“Boundaries of Dissent: Protest and State Power in the Media Age”,
“author”: [
{
“family”: “D’Arcus”,
“given”: “Bruce”,
“static-ordering”: false
}
],
“note”:“The apostrophe in Bruce’s name appears in proper typeset form.”,
“publisher”: “Routledge”,
“issued”: {
“date-parts”:[
[2005, 11, 22]
]
},
“type”: “book”
},
“ITEM-2”: {
“id”: “ITEM-2”,
“author”: [
{
“family”: “Bennett”,
“given”: “Frank G.”,
“suffix”: “Jr.”,
“static-ordering”: false
}
],
“title”:“Getting Property Right: “Informal” Mortgages in the Japanese Courts”,
“container-title”:“Pacific Rim Law & Policy Journal”,
“volume”: “18”,
“page”: “463-509”,
“issued”: {
“date-parts”:[
[2009, 8]
]
},
“type”: “article-journal”,
“note”: “Note the flip-flop behavior of the quotations marks around “informal” in the title of this citation. This works for quotation marks in any style locale. Oh, and, uh, these notes illustrate the formatting of annotated bibliographies (!).”
}
}