Title: How to parse top-level JSON array?
Last modified: July 2, 2024

---

# How to parse top-level JSON array?

 *  Resolved [acmswebmaster](https://wordpress.org/support/users/acmswebmaster/)
 * (@acmswebmaster)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-parse-top-level-json-array/)
 * 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](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-parse-top-level-json-array/#post-17864259)
 * hi,
 * can you try it without basenode and subloop?
 * Bernhard
    -  This reply was modified 1 year, 11 months ago by [berkux](https://wordpress.org/support/users/berkux/).
 *  Thread Starter [acmswebmaster](https://wordpress.org/support/users/acmswebmaster/)
 * (@acmswebmaster)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-parse-top-level-json-array/#post-17864352)
 *     ```wp-block-code
       [    {        "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": [                    "http://zotero.org/groups/4991506/items/FZHY66E7",                    "http://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](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-parse-top-level-json-array/#post-17870838)
 * Hi,
   try this (this is generated out of the JCI free Gutenberg-Block):
 *     ```wp-block-code
       [jsoncontentimporter url="http://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.

 * ![](https://ps.w.org/json-content-importer/assets/icon-256x256.png?rev=3464653)
 * [Get Use APIs - JSON Content Importer](https://wordpress.org/plugins/json-content-importer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-content-importer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-content-importer/)
 * [Active Topics](https://wordpress.org/support/plugin/json-content-importer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-content-importer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-content-importer/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [berkux](https://wordpress.org/support/users/berkux/)
 * Last activity: [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-parse-top-level-json-array/#post-17870838)
 * Status: resolved