[Feature request] Nimbus Notes import

Nimbus Notes’ export is a JSON file and a folder of attached pictures. JSON contains various data like folders, date of creation/update, tags, geotag, link, tasks etc. The notes themselves are in HTML.

Example:

{
      "elem_type":"folder",
      "folder_id":"o1470054488x0031",
      "folder_name":"Music",
      "type":"0",
      "tags":[""],
      "b_syncdirty":"0",
      "b_removed":"0",
      "flags":"0",
      "subfolders":
      [
        {
        "elem_type":"folder",
        "folder_id":"o1470054462x0017",
        "folder_name":"Things",
        "type":"0",
        "tags":[""],
        "b_syncdirty":"0",
        "b_removed":"0",
        "flags":"0",
        "subfolders":
        [
        ],
        "notes":
        [
          {
          "note_id":"o1470054462x0018",
          "date_create":"1377848280",
          "date_update":"1377848280",
          "note_title":"Building a six-channel floppy drive synth from start to finish",
          "b_syncdirty":"0",
          "b_removed":"0",
          "b_shared":"0",
          "sync_priority":"0",
          "num_tasks":"0",
          "editable":"1",
          "preview_text":"Text We've seen scores of floppy drives play music, but never before have we seen a project as clean as [Rupert]'s Moppyduino. It's an Arduino-based board that controls the stepper motors in six separate floppy drives, coaxing them in to playing mus",
          "content_data":"<div><div><center>\n  <img src=\"http:\/\/hackadaycom.files.wordpress.com\/2013\/02\/floppy.jpg?w=580&amp;h=242\" alt=\"Building a six-channel floppy drive synth from start to finish\">\n<\/center>\n      <div>\n      <span style=\"color: #aaa\">\n        Text\n      <\/span>\n      <br>\n      <span style=\"color: #000\">\n        We've seen scores of floppy drives play music, but never before have we seen a project as clean as [Rupert]'s Moppyduino. It's an Arduino-based board that controls the stepper motors in six separate floppy drives, coaxing them in to playing music from a MIDI file.\n      <\/span>\n    <\/div><div>&nbsp;<\/div>\n        <div>\n      <span style=\"color: #aaa\">\n        Videos\n      <\/span>\n      <br>\n      <span style=\"color: #000\">\n        <a href=\"https:\/\/www.youtube.com\/v\/IYQWLlBz8hE?version=3&amp;f=videos&amp;app=youtube_gdata\">https:\/\/www.youtube.com\/v\/IYQWLlBz8hE?version=3&amp;f=videos&amp;app=youtube_gdata<\/a>\n      <\/span>\n    <\/div><div>&nbsp;<\/div>\n      <\/div><div>&nbsp;<\/div>\t\t<\/div>",
          "owner":"",
          "url":"http:\/\/hackaday.com\/2013\/02\/13\/building-a-six-channel-floppy-drive-synth-from-start-to-finish\/",
          "geo_str1":"0.000000",
          "geo_str2":"0.000000",
          "page_color":"16777215",
          "tags":["public"],
          "tasks":[  ],
          "attach_list":[
          ]
          },

I have ~700 notes so it’s impossible to migrate by hand and without a proper tool.

Import from Nimbus won’t be supported, however it shouldn’t be too hard to create an importer for it using the Joplin API. You’d need to know some scripting though or maybe find someone that can do it for you.

1 Like

Sorry to necropost, but this is the only google result and I have a working solution. No guarantees but it might get you part of the way there at least. Prerequisites: python version 3, "pip install markdownify". This creates a directory full of .md files which you can import with file > import > markdown (directory)

import os, json, re, pathlib
from markdownify import markdownify

json_file_path = "Your.Name.json"

with open(json_file_path, 'r', encoding="utf8") as json_file:
    json_text = json_file.read()

evernote_obj_list = json.loads(json_text)

notes_written = 0 
def write_notes(folder_name, evernote_entry):
    global notes_written 
    if "subfolders" in evernote_entry:
        for subfolder in evernote_entry["subfolders"]:
            subfolder_name = folder_name = re.sub(r"[?:()]+", "", folder_name)
            subfolder_name = re.sub(r"[?:()\"<>]+", "", subfolder_name)
            subfolder_name = re.sub(r"[/\\]+", "-", subfolder_name)
            new_folder_name = f"{folder_name + os.path.sep if folder_name != '' else '' }{subfolder['folder_name']}{os.path.sep}"
            write_notes(new_folder_name, subfolder)

    if "notes" in evernote_entry:
        for note in evernote_entry["notes"]:
            note_html = note["content_data"]
            # print(note_html)
            note_filename =note['note_title']
            note_filename = re.sub(r"[?:()\"<>]+", "", note_filename)
            note_filename = re.sub(r"[/\\]+", "-", note_filename)
            note_filename = note_filename[:80]  + ".md"
            full_dir = f"Your Name Notes{os.path.sep}{folder_name}"
            pathlib.Path(full_dir).mkdir(parents=True, exist_ok=True)
            destination = f"{full_dir}{note_filename}"
            print(f"Saving note to {destination}")
            with open(destination, "w", encoding="utf8") as destination_handle:
                note_markdown = markdownify(note_html)
                destination_handle.write(note_markdown)
                notes_written += 1
    

for i in range(1, len(evernote_obj_list)):
    folder_name = ""
    if "folder_name" in evernote_obj_list[i]:
        # trim out disallowed characters 
        folder_name = re.sub(r"[?:()/\\<>]+", "-", evernote_obj_list[i]["folder_name"])
        folder_name = re.sub(r"[\"]+", "", folder_name)
        #if folder_name.upper() == "TRASH":
            #continue
        folder_name = os.path.sep + folder_name + os.path.sep
       
    write_notes(folder_name, evernote_obj_list[i])

print(f"Wrote {notes_written} notes.")
2 Likes

As a newbie when it comes to python etc. Could I please request a breakdown as to exactly what I need to do to get nimbus notes into Joplin? I managed to get the file structure in fine, but I cannot get the notes in.
Any help appreciated.

Sure. Export your nimbus notes to JSON. Change Your.Name.json to the json file name in the python file. Find the install for a version of python 3 for your operating system. Save the python script in my post (in the code block) as something like convert.py. Depending on how you install you might have to find out how to set up "pip" which is a package manager for python. Once you have that working you will be able to do the command "pip install markdownify" to install the package the script needs. Then you can open up your command prompt and go into the directory where your json file is and the convert.py should be in the same directory (e.g. "cd C:/Users/chris/Downloads/notes_convert/convert.py"). Run the command "python convert.py" and see if it works for you. If it does it will create a subdirectory. Then in Joplin File > import > markdown (Directory)

Let me know any other trouble you have

1 Like

Apologies but stuck already, how do I get the JSON file out of nimbus as the only export functions are pdf and html?

1 Like

Wow it seems like they already removed JSON export. I just downloaded the app to see. I just went through the migration with my coworker last week so I'm surprised it's gone so fast. I'm not sure if you can get a hold of a slightly older version that allows the JSON export.

If you export all notes to HTML, I might be able to help. I would need to rewrite my script a little bit. Just lame since the JSON was way easier. Maybe their product management people saw this thread and disabled the JSON export to get one over on people jumping the Nimbus ship...lol...

2 Likes

23333

I would definitely say 23333 yeah

2 Likes

I will try my best to avoid using this kind of tool that is difficult to move out and avoid platform binding.

Although it's a pity that the company's office tools (survival) and wechat (family) can't be lost

Updating this script now. Note it accidentally said evernote (I used Evernote before Joplin and just typo'd) but it was for a nimbus note JSON. I'm working on a HTML version. It probably won't include image attachments in the result

1 Like

New instructions:

Export your Nimbus Notes to HTML. Save the full path that you exported to e.g. ~/nimbus/export-YYYY[...] or C:/Users/myusername/Documents/nimbus/export-YYYY[...]

Save the following python script to convert.py in that same directory you just saved:


from zipfile import ZipFile


import os, re, pathlib
from markdownify import markdownify

from os.path import abspath

html_dir = abspath('.')

notes_written = 0
sep = os.path.sep

print(
    f"Will try to convert all HTML-exported nimbus notes in {html_dir} to Markdown")
for directory, subdirlist, filelist in os.walk(html_dir):
    for f in filelist:
        zip_extension = ".zip"
        extension = f[len(f)-len(zip_extension):]
        if (extension.lower() == zip_extension):
            print(f"Found zipped note: {f}")
            with ZipFile(f"{directory}{sep}{f}", 'r') as zip:
                # printing all the contents of the zip file
                for info in zip.infolist():
                    html_extension = ".html"
                    extension_in_zip = info.filename[len(
                        info.filename) - len(html_extension):]
                    if extension_in_zip.lower() == html_extension:
                        print(f"\tFound note {info.filename}")
                        html_content = zip.read(info.filename).decode()
                        html_content = html_content.replace("<!doctype html>", "")
                        html_content = re.sub(r"<title.*?</title>", "", html_content)
                        markdown_content = markdownify(html_content, strip=['head', 'title'], header_style='ATX')
                        note_name = f.replace(zip_extension, "")
                        converted_dir = directory.replace(
                            html_dir, f".{sep}converted")
                        markdown_destination = f"{converted_dir}{sep}{ note_name }.md"
                        print(f"Writing markdown to {markdown_destination}.md")
                        pathlib.Path(converted_dir).mkdir(
                            parents=True, exist_ok=True)
                        with open(markdown_destination, 'w') as markdown_file:
                            markdown_file.write(markdown_content)
                        notes_written += 1


print(f"Wrote {notes_written} notes.")

Install python

Open a terminal (command prompt -> Run as Administrator on windows)

Verify you can now run python by doing these commands:

python --version
pip --version

If you get a message like "python (or pip) is not recognized as[...]" then follow these instructions to add pip and python to your $PATH:

https://datatofish.com/add-python-to-windows-path/

If you had to manually add to your $PATH, close the terminal and open a new one the same way. Issue this command:

pip install markdownify

^ This is a command you do once to install dependencies.

Now you are ready to convert your files. You need to change directories to the directory you saved earlier (as of this writing the folder looks like export-YYYY[...]). You can keep the terminal with the successful pip install open and do it there, or open a new one without running as administrator. The convert.py script doesn't need to be run as Administrator.

To do this:

cd pastethefullexportdirectoryhere

Your terminal should show the directory you are in now like this

Now run this:

python convert.py

If everything went according to plan it should print out a summary of the converted notes.

Then you want to go to Joplin and file > import > markdown (directory). The new notebook will be called 'converted'. You can rename it to whatever.

Let me know any issues. Keep in mind I haven't really researched how Joplin designates images or metadata so the imported data will basically just be the title and text of the note.

4 Likes

Wow, many many thanks. I will give it a go and report back.

Managed to import around 40 notes and 7 folders out of many more. The notes that have imported do not show images I am afraid and some formatting is of. Maybe my error of course.

1 Like

OK I might have missed something in finding notes. I wonder if you could take some screenshots of some of the notes exported from Nimbus that didn't make it in (screenshots of the folder with the zip / html files). I did mention earlier that I'm not sure how to import the images yet. Maybe I could create some notes in Joplin with images and see how hard that would be to recreate but no promises

As far as the formatting... not sure how much I can do about it as all the work of converting to markdown is being done by this markdownify package. Not sure if there is a better one out there that is more faithful but it might be something you have to kind of tweak after you get an import

If you can send an example export where some formatting is messed up there might be a way to fix it. But I'm not sure. I think the image thing might not be too hard

OK I'm going to start storing the code here:

This included an image in the Joplin import when I tested it. I think I would have to see some examples of missed notes to determine what I did wrong.

Edit: apparently i am no longer allowed to reply to this topic. It says I am a new user and can't reply more than three times...

Nimbus_Joplin.docx (393.0 KB)

File attached with screenshots, I hope this helps.
Many thanks.

1 Like

thanks for the doc, any detailed screenshots or example html files you can send will really make this easier. I probably won't have time to edit the script again for a few days, but in the meantime try to include as much info as possible - not just the folders but basically at least screenshots of the notes (poke around and take as many screenshots as possible, including of html content of files with the worst formatting mistakes or attaching the html content of non sensitive notes) so that I can tell what I am skipping

Apologies but not had time as yet, hopefully by Friday.

1 Like