• Resolved acmswebmaster

    (@acmswebmaster)


    The results of a query to the Zotero API give back JSON which at the top level is an array of objects. So, to loop over these objects with subloop-array, I think I need to specify a basenode=<somethinghere>, but there is no basenode in this case.

    Is it possible, with the Free version, to handle situation?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author berkux

    (@berkux)

    hi,

    can you try it without basenode and subloop?

    Bernhard

    • This reply was modified 8 months, 3 weeks ago by berkux.
    Thread Starter acmswebmaster

    (@acmswebmaster)

    [
    {
    "key": "8PADRAJJ",
    "version": 18555,
    "library": {
    "type": "group",
    "id": 4991506,
    "name": "Bibliography of Christianity and Mathematics Project",
    "links": {
    "alternate": {
    "href": "https://www.zotero.org/groups/4991506",
    "type": "text/html"
    }
    }
    },
    "links": {
    "self": {
    "href": "https://api.zotero.org/groups/4991506/items/8PADRAJJ",
    "type": "application/json"
    },
    "alternate": {
    "href": "https://www.zotero.org/groups/4991506/items/8PADRAJJ",
    "type": "text/html"
    }
    },
    "meta": {
    "createdByUser": {
    "id": 11310786,
    "username": "CJongsma",
    "name": "Calvin Jongsma",
    "links": {
    "alternate": {
    "href": "https://www.zotero.org/cjongsma",
    "type": "text/html"
    }
    }
    },
    "creatorSummary": "Sullivan",
    "parsedDate": "1952",
    "numChildren": 0
    },
    "data": {
    "key": "8PADRAJJ",
    "version": 18555,
    "itemType": "bookSection",
    "title": "Schools of Thought Concerning Mathematics Foundations",
    "creators": [
    {
    "creatorType": "author",
    "firstName": "Helen, O.S.B.",
    "lastName": "Sullivan"
    }
    ],
    "abstractNote": "This is Chapter XIII of the book.\nDoiscusses the overall aims of the three major schools of 20th-century philosophy of mathematics (logicism, formalism, intuitionism).\n [CJ]",
    "bookTitle": "An Introduction to the Philosophy of Natural and Mathematical Sciences",
    "series": "",
    "seriesNumber": "",
    "volume": "",
    "numberOfVolumes": "",
    "edition": "",
    "place": "New York",
    "publisher": "Vantage Press",
    "date": "1952; 2021",
    "pages": "136-147",
    "language": "English",
    "ISBN": "978-1-01-394356-0",
    "shortTitle": "Concerning Mathematics Foundations",
    "url": "",
    "accessDate": "",
    "archive": "",
    "archiveLocation": "",
    "libraryCatalog": "Amazon",
    "callNumber": "",
    "rights": "",
    "extra": "",
    "tags": [
    {
    "tag": "Aquinas"
    },
    {
    "tag": "Aristotle"
    },
    {
    "tag": "Christian perspective"
    },
    {
    "tag": "Descartes"
    },
    {
    "tag": "Newton"
    },
    {
    "tag": "Plato"
    },
    {
    "tag": "Pythagoreans"
    },
    {
    "tag": "Thomism"
    },
    {
    "tag": "curriculum"
    },
    {
    "tag": "epistemology"
    },
    {
    "tag": "foundations of mathematics"
    },
    {
    "tag": "geometry"
    },
    {
    "tag": "history of mathematics"
    },
    {
    "tag": "logic"
    },
    {
    "tag": "mathematics education"
    },
    {
    "tag": "mathematization"
    },
    {
    "tag": "motion"
    },
    {
    "tag": "philosophy of mathematics"
    },
    {
    "tag": "quantity"
    },
    {
    "tag": "space"
    },
    {
    "tag": "truth"
    }
    ],
    "collections": [],
    "relations": {
    "dc:relation": [
    "https://zotero.org/groups/4991506/items/FZHY66E7",
    "https://zotero.org/groups/4991506/items/SXXSR3WG"
    ]
    },
    "dateAdded": "2024-06-12T17:11:29Z",
    "dateModified": "2024-06-13T16:46:09Z"
    }
    },
    ... many more objects here...
    ]

    The above is the first object in the array. I don’t know how to get at that object.

    I tried {[0].data.title} but that didn’t work:

    DEBUG: basenode: no basenode defined
    DEBUG: template:
    {[0].data.title
    }

    Plugin Author berkux

    (@berkux)

    Hi,
    try this (this is generated out of the JCI free Gutenberg-Block):


    [jsoncontentimporter url="https://test.json-content-importer.com/extra/json/vxcsdvevf.json" debugmode="10"]key = {key}


    version = {version}


    {subloop:library:-1}

    type = {library.type}


    id = {library.id}


    name = {library.name}


    {subloop:library.links:-1}

    {subloop:library.links.alternate:-1}

    href = {library.links.alternate.href}


    type = {library.links.alternate.type}


    {/subloop:library.links.alternate}

    {/subloop:library.links}

    {/subloop:library}

    {subloop:links:-1}

    {subloop:links.self:-1}

    href = {links.self.href}


    type = {links.self.type}


    {/subloop:links.self}

    {subloop:links.alternate:-1}

    href = {links.alternate.href}


    type = {links.alternate.type}


    {/subloop:links.alternate}

    {/subloop:links}

    {subloop:meta:-1}

    {subloop:meta.createdByUser:-1}

    id = {meta.createdByUser.id}


    username = {meta.createdByUser.username}


    name = {meta.createdByUser.name}


    {subloop:meta.createdByUser.links:-1}

    {subloop:meta.createdByUser.links.alternate:-1}

    href = {meta.createdByUser.links.alternate.href}


    type = {meta.createdByUser.links.alternate.type}


    {/subloop:meta.createdByUser.links.alternate}

    {/subloop:meta.createdByUser.links}

    {/subloop:meta.createdByUser}

    creatorSummary = {meta.creatorSummary}


    parsedDate = {meta.parsedDate:datetime,d.m.Y, H:i:s,0}


    numChildren = {meta.numChildren}


    {/subloop:meta}

    {subloop:data:-1}

    key = {data.key}


    version = {data.version}


    itemType = {data.itemType}


    title = {data.title}


    creators:


    {subloop-array:data.creators:-1}


    creatorType = {data.creators.creatorType}


    firstName = {data.creators.firstName}


    lastName = {data.creators.lastName}


    {/subloop-array:data.creators}


    abstractNote = {data.abstractNote}


    bookTitle = {data.bookTitle}


    series = {data.series}


    seriesNumber = {data.seriesNumber}


    volume = {data.volume}


    numberOfVolumes = {data.numberOfVolumes}


    edition = {data.edition}


    place = {data.place}


    publisher = {data.publisher}


    date = {data.date}


    pages = {data.pages}


    language = {data.language}


    ISBN = {data.ISBN}


    shortTitle = {data.shortTitle}


    url = {data.url}


    accessDate = {data.accessDate}


    archive = {data.archive}


    archiveLocation = {data.archiveLocation}


    libraryCatalog = {data.libraryCatalog}


    callNumber = {data.callNumber}


    rights = {data.rights}


    extra = {data.extra}


    tags:


    {subloop-array:data.tags:-1}


    tag = {data.tags.tag}


    {/subloop-array:data.tags}


    collections:


    {subloop-array:data.collections:-1}


    {data.collections.}

    {/subloop-array:data.collections}


    {subloop:data.relations:-1}

    dc:relation:


    {subloop-array:data.relations.dc:relation:2}


    {data.relations.dc:relation.0} {data.relations.dc:relation.1}

    {/subloop-array:data.relations.dc:relation}


    {/subloop:data.relations}

    dateAdded = {data.dateAdded:datetime,d.m.Y, H:i:s,0}


    dateModified = {data.dateModified:datetime,d.m.Y, H:i:s,0}


    {/subloop:data}[/jsoncontentimporter]
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to parse top-level JSON array?’ is closed to new replies.