CSL Json Export
Hi there,
Is there anyway to edit the CSL Json export file so as to get my Zotero tags in there?
I'm using the Json file from my Zotero database (+2000 entries) as a feed for an online dataTables render. I would like to just export the file to an FTP and have the database update.
Is there anyway to edit the CSL Json export file so as to get my Zotero tags in there?
I'm using the Json file from my Zotero database (+2000 entries) as a feed for an online dataTables render. I would like to just export the file to an FTP and have the database update.
doExport function: https://github.com/zotero/translators/blob/master/CSL JSON.js#L68
You already have the item (which contains item.tags) and you have the CSL JSON created by ZU.itemToCSLJSON(item), so you'd just need to add the tags into the JSON in the format you'd like (likely an array?) before pushing the item to the data array.
We can see if we'd want to modify the itemToCSLJSON function more generally -- that's my question above -- but a) that's going to take longer and b) it'd almost certainly include the tags as a (comma or semicolon delimited) string, which isn't ideal.
function doExport() {
var item, data = [];
while(item = Z.nextItem()) {
var itemJSON = ZU.itemToCSLJSON(item);
itemJSON = itemJSON.push(item.tags);
data.push(itemJSON);
}
Z.write(JSON.stringify(data, null, "\t"));
}
function doExport() {
var item, data = [];
while(item = Z.nextItem()) {
var itemJSON = ZU.itemToCSLJSON(item);
itemJSON.keyword = item.tags.join(", ");
data.push(itemJSON);
}
Z.write(JSON.stringify(data, null, "\t"));
}
itemJSON.keyword = item.tags.map(o => o.tag).join(", ");