My iPhone got really slow the other week, and the local Apple Genius suggested a full restore to get it back to factory settings. Fair enough, it seemed to fix the problem, and after syncing with iTunes I had all my apps back, only....
No more notes.
It turns out that iTunes doesn't sync the data from the Notes app, so the only way to get them back is from an old backup. A quick Google turned up various tricks involving Grep, Python and Mac-related tools for extracting data from the iPhone backup files, but there's a much simpler way. And it works in Windows too.
1) Run Backup Extractor for iPhone (Reincubate, trial).
The trial lets you extract one SQLite database file (.db) at a time from a backup file.
Choose an iPhone backup, then select which database to restore (in this case, Library > Notes).
2) Run SQLite Data Wizard (SQLMaestro, trial).
Select the file from above, choose your output format (e.g. CSV) and the note_bodies table.
You should now have your beloved iPhone notes back, in the format of your choice.