Unable to import my notes back to Joplin

Joplin version: 1.0.201.
OS: Ubuntu 18.04.

I am trying to import my notes back to Joplin which I previously exported. I used “JSON - Json Export Directory” format for export. Today when I am trying to import back there is no option to import back this format. Please help me in importing my notes back.

Thanks you in advance.

1 Like

Have you tried MD - Markdown (Directory) ?
Looks like being a good candidate.

I am sorry I couldn’t understand your question. They are not in Joplin. They were deleted from Joplin after export using JSON format. But apparently there is no JSON import option to import them back.

@laurent @foxmask
I am thankful to you guys for building such a great tool. But think it’s a bug that Joplin allows to export in a format that it doesn’t accept back. I would very thankful for your attention and response.

Hi,
you could read this from documentation. Also this mentioned tutorial, which explain how to convert JSON files to ENEX format.
I agree with you on the lack of warning on the export formats that don’t allow the import.

1 Like

There’s nothing wrong in not importing a format that can be exported, however I agree that in this particular case (JSON) it might be confusing because it’s more like a machine-readable format.

It was added by a user at some point and I think I’m actually going to remove it. There’s no good reason for it to exist since as a machine readable format we already have JEX, which is not hard to parse.

1 Like

Hi,
Thank you for your response. Unfortunately it’s not working.

And what inline images? how this type tool would help in importing them back?

Hi Laurent,

Thank you for your response. Yes so nobody get into this situation in future. Can you please help me to recover from it? There are many important notes that I cannot afford to lose.

Regards,

In the discussion after the tutorial there is a post from the author that states:

You've followed the steps correctly, and along the way you've learned. I suspect you're running python3 but it's still running python2.

(My emphasis)

Hi,
This is the version of python I'm using. Let me know if it's not correct.
image

The bit that says "Python 3.6.9" kind of tells you that it's not Python 2.

Edit: and the command you used was "python3" :slight_smile:

1 Like

On the command line just type “python” and see what you get…

@dpoulton
It says Python 2.7.17
image

Does the script work using Python2?

As in:

python standard-notes-to-enex.py notes.txt

Tried with Python 2:

EDIT-1: No luck :worried:

EDIT-2: Fixed some minor syntax related to the print line. Now python 2 error is same as python 3.

I thought it may have been a bit of a long shot as I could not see why a Standard Notes JSON export would be the same structure as a Joplin JSON export.

1 Like

@furusiyya

Did you ever sync your notes with a server and, if you did, do you have Joplin on any other computer and how did you delete your notes after the JSON export? Did you delete all notes and allow Joplin to sync or did you just delete the .config/joplin-desktop folder?

I have Joplin at my Mobile but I allowed Joplin to sync after delete.

I do not have the knowledge to figure out a way to convert a JSON export to something Joplin can import. Therefore I am trying to think of other ways.

When you sync and that sync deletes files, does your online storage place those files in a “Recycle Bin” like Nextcloud does?

I am wondering if it would be possible to:

  • delete the ~/.config/joplin-deskop folder on your deskop computer, which reverts Joplin to being like a new install,
  • restore everything from the online storage “Recycle Bin” back into its original positions on the online storage (which hopefully it does automatically) and,
  • then reconnect the desktop Joplin to your sync target.

I am just trying to think of a way of getting notes back for long enough to make a JEX Export. Then the online storage / Joplin can be tided up again and the JEX Export imported.

If you do try this make sure that Joplin is not active on your mobile in case it detects any restored files as old and deleted and deletes them again. The mobile device can be sorted out afterwards by deleting the app’s cache / storage before running it again.

You may want to wait to see if any others see any flaws in the above before you start or whether they have any better suggestions…

I decided to write a python script to convert JSON into MD. After running this script, I successfully imported my notes back to Joplin.

for filename in os.listdir(os.getcwd()):
final_file = ''
try:
    data = json.load(open(filename))
    for key, item in enumerate(data):
        if item == 'title':
            final_file+=data[item]
            final_file+="\n\n"
        if item == 'body':
            final_file+=data[item]
        title = data['title']+'.md'
        with open(title, "w") as text_file:
            text_file.write(final_file)
except:
    print("\n\n\n"+filename+"\n\n\n")
    continue
3 Likes