Hi! I’m trying to add metadata to my Tropy file using R. I’ve succesfully imported the JSON file to R, added my new metadata and now I need to export it so that I can create a new Tropy file with the updated database. I’ve tried using the package “jsonlite” to export the JSON file but when I try to import it to Tropy I get the following error:
“TypeError: Invalid Version: 1.12.0\n”
The problem is definitely in R because I’ve also tried importing the JSON file and exporting it without making any changes and it returns the exact same error. I exported a sample with just a few items to explore the files and see if there were major syntax differences but I only identify that R inserts brackets everywhere in the @ context section and I’m not sure if they are relevant or not, and I don’t know how to export them differently. Here is a sample of both files (I had to add random spaces after @ and links because of the forum requirements):
Tropy export:
{ “@ context”: {
“@ version”: 1.1,
“@ vocab”: “https : //tropy.org/v1/tropy#”,
“template”: {
“@ type”: “@ id”
},
“photo”: {
“@ id”: “https ://tropy.org/v1/tropy#photo”,
“@ container”: “@ list”
},
“note”: {
“@ id”: “https ://tropy.org/v1/tropy#note”,
“@ container”: “@ list”
},
“selection”: {
“@ id”: “https ://tropy.org/v1/tropy#selection”,
“@ container”: “@ list”
},
“title”: “http ://purl.org/dc/elements/1.1/title”, “date”: {
“@ id”: “http ://purl.org/dc/elements/1.1/date”,
“@ type”: “https ://tropy.org/v1/tropy#date”
},
“@ graph”: [
{
“@ type”: “Item”,
“template”: “https ://tropy.org/v1/templates/id#xaTfW7Yh”,
“title”: “file_title”,
“list”: [
“list_1”,
“list_2”
],
“tag”: [
“tag_1”,
“tag_2”
],
“photo”: [
{
“@ type”: “Photo”,
“checksum”: “5c4fc32b7efbf4bccadc305736c0dddd”,
“color”: “rgb(200,200,200,1)”,
“density”: null,
“filename”: “file_name.jpg”,
“mimetype”: “image/jpeg”,
“orientation”: 6,
“page”: 0,
“path”: “path.jpg”,
“protocol”: “file”,
“size”: 2579168,
“template”: “https ://tropy.org/v1/templates/photo”,
“angle”: 0,
“brightness”: 0,
“contrast”: 0,
“height”: 3072,
“hue”: 0,
“mirror”: false,
“negative”: false,
“saturation”: 0,
“sharpen”: 0,
“width”: 4080,
“title”: “photo_title”,
“date”: 1669632140000
}
]
}
],
“version”: “1.12.0”
}
R export:
{
“@ context”: {
“@ version”: [1.1],
“@ vocab”: [“https ://tropy.org/v1/tropy#”],
“template”: {
“@ type”: [“@ id”]
},
“photo”: {
“@ id”: [“https ://tropy.org/v1/tropy#photo”],
“@ container”: [“@ list”]
},
“note”: {
“@ id”: [“https ://tropy.org/v1/tropy#note”],
“@ container”: [“@ list”]
},
“selection”: {
“@ id”: [“https ://tropy.org/v1/tropy#selection”],
“@ container”: [“@ list”]
},
“date”: {
“@ id”: [“http ://purl.org/dc/elements/1.1/date”],
“@ type”: [“https ://tropy.org/v1/tropy#date”]
}
},
“@ graph”: [
{
“@ type”: “Item”,
“template”: “https ://tropy.org/v1/templates/id#xaTfW7Yh”,
“title”: “file_title”,
“list”: [“list_1”, “list_2”],
“tag”: [“tag_1”, “tag_2”],
“photo”: [
{
“@ type”: “Photo”,
“checksum”: “5c4fc32b7efbf4bccadc305736c0dddd”,
“color”: “rgb(200,200,200,1)”,
“filename”: “file_name.jpg”,
“mimetype”: “image/jpeg”,
“orientation”: 6,
“page”: 0,
“path”: “path.jpg”,
“protocol”: “file”,
“size”: 2579168,
“template”: “https ://tropy.org/v1/templates/photo”,
“angle”: 0,
“brightness”: 0,
“contrast”: 0,
“height”: 3072,
“hue”: 0,
“mirror”: false,
“negative”: false,
“saturation”: 0,
“sharpen”: 0,
“width”: 4080,
“title”: “photo_title”,
“date”: 1669632140000
}
]
}
],
“version”: [“1.12.0”]
}
I’m sure this is very simple to fix but I’ve not found any clear solution. If anyone has a sample script for exporting the JSON file in R so that Tropy can read it succesfully it would be amazing.
Thank you!