To preface this, while I am still fairly new to JavaScript, I have enough coding knowledge from working with other formats to get a general sense of most terms. That said, anything beyond the basics of defining objects, functions, etc. is something I'm still making the transition to, so I apologize in advance if anything goes over my head initially.
Anyway, while I've quickly been learning how useful notetags are for working with plugins, I've also been finding it incredibly annoying to work with them inside of the database itself, especially if they include JavaScript statements. It's to the point that I've taken to writing out and editing the notetags in a separate text editor, then copying and pasting them into the respective notes section of the database when I'm finished. Of course, this means that if I'm trying to tweak or troubleshoot the contents of a note, I have to be constantly swapping between the two. I suppose the alternative is to edit the values in the JSON file directly, but I've found that this can get messy if I have a large number of entries to navigate. I would much rather be able to view just the note sections for entries where I've actually entered notes.
So my question is whether it's possible to cut out the middleman and create a script that lets me define the note sections in a separate JSON file, then have them be pushed to the respective note sections of the existing JSON files directly. That way it would negate any additional noise created by other information already present in the existing JSON file, and I wouldn't need to be constantly going back and forth between my text editor and the database.
From what I've learned so far, it seems that I will need to be able to:
This might be a very convoluted way of solving my issue, but if it's something that can reasonably be accomplished (or even better, has already been done in a plugin) then it would make my life much easier.
Anyway, while I've quickly been learning how useful notetags are for working with plugins, I've also been finding it incredibly annoying to work with them inside of the database itself, especially if they include JavaScript statements. It's to the point that I've taken to writing out and editing the notetags in a separate text editor, then copying and pasting them into the respective notes section of the database when I'm finished. Of course, this means that if I'm trying to tweak or troubleshoot the contents of a note, I have to be constantly swapping between the two. I suppose the alternative is to edit the values in the JSON file directly, but I've found that this can get messy if I have a large number of entries to navigate. I would much rather be able to view just the note sections for entries where I've actually entered notes.
So my question is whether it's possible to cut out the middleman and create a script that lets me define the note sections in a separate JSON file, then have them be pushed to the respective note sections of the existing JSON files directly. That way it would negate any additional noise created by other information already present in the existing JSON file, and I wouldn't need to be constantly going back and forth between my text editor and the database.
From what I've learned so far, it seems that I will need to be able to:
- Read the original JSON file
- Read the custom JSON file
- Locate the objects in each file that correspond to the ID of the entries I want to edit (for example, an Actor ID) if both exist
- Locate the "note" value in those matching object
- Write the contents of that value in the custom file to the original file without overwriting the entire object/file
This might be a very convoluted way of solving my issue, but if it's something that can reasonably be accomplished (or even better, has already been done in a plugin) then it would make my life much easier.