This and this page might be worth a look.
If you simply want to export your generated markdown to Joplin, you can use File -> Import -> Markdown (File)
.
If you want to preserve the hierarchy it gets difficult. I'm not an expert on the import feature, but I think it isn't possible OOTB. I guess there are two options:
- Split the HTML file in a folder/file hierarchy and convert to markdown. Then use
File -> Import -> Markdown (Directory)
- Create the notebooks/notes by data API calls.