Contentful logo

Contentful Community

Import HTML content into Rich Text field using Python SDK

I’m creating scripts to import data from a legacy system into Contentful using the Python SDK. But I can’t find a way to convert the HTML content into the JSON format that contentful requires. Is there any pre-built plugin/code available to do so? Or will I have to create a custom script to convert HTML into the required JSON format?

Any help or pointers will be highly appreciated.

Hi @vishal.deep, there are not plugin developed by Contentful for such case. However, these resources might help you:

  1. Migrate Markdown to RichText (JS): https://www.contentful.com/developers/docs/tutorials/general/migrate-to-rich-text/
  2. Python HTML2Markdown converter: https://pypi.org/project/html2markdown/