Find and replace text for Day One JSON exports.
Instructions for how to run the script locally on your computer.
It is preferred you own a Mac with Day One on it.
If you do NOT own a Mac, but have access to a Mac, you may export your journals to JSON from the iOS client and AirDrop them to the Mac.
- Export your Day One Journals as JSON. (File -> Export -> JSON)
- Unzip your exported journals.
- Download the ZIP file of THIS project or if you're tech savvy clone this project. (Green Button)
- Locate the project you just downloaded and unzip it.
- For ease of use later, put your exported journals folder(the unzipped one) along side this projects directory.
- Also for ease of use, rename your exported journals directory from
Export - All Entries (2018-11-24)
tojournals
- Using Mac's built in finder(spotlight), search for
Terminal
.
- Type
ls
to view the directories on your Mac. - Assuming you still have the project in your
Downloads
folder, typecd Downloads
- Type
cd DayOne-Find-And-Replace-master
This script was made in Python, and fortunately Mac ships with Python!
- Type
python main.py --word-replaced veggies --word-replacing pizza
Before you hit enter. You need to change veggies
to the word you want to be replaced in your journal(s), and pizza
with the one you want to take it's place.
If you want to change juice
to diet coke
you will have to include a back slash to take into account the space. So for example:
python main.py --word-replaced juice --word-replacing diet\ coke
Now you have two options. You can either give the script one single journal, or all the journals.
If you followed step 5 and 6, the path to the file should be correct.
- Going back to what we typed, finish typing it
python main.py --word-replaced veggies --word-replacing pizza --folder-in ../journals
-
Now instead of typing a directory, we will just give the path of the file, for example:
python main.py --word-replaced veggies --word-replacing pizza --file-in ../journals/My Smelly Journal.json
-
Hit enter!
It will create a duplicate of the file with the text (updated)
on the end.
Either confirm everything is correct before importing, or just import 😃(keep the backup temporarily just in case)
-
Zip up your journals, by right clicking on your directory(
journals
) and clickingcompress
-
Import journal back into Day One! (File -> Import -> JSON Zip File)
Voila! You're done! Enjoy!
As you probably noted at the first example image some other numbers were changed.
I did a diff on the files, and unfortunately there's a slight loss when I load in the JSON(or so I think). The large numbers that Day One stores get slightly tweaked. The three that I've seen change are latitude
, longitude
, and visibilityKM
. Doesn't seem like a big deal to me, but if you want to fix it, then by all means PR's are accepted. (:
This project is licensed under the MIT License - see the LICENSE.md file for details