Generate HTML string from JSON

I save editor json data in my database. I would like to also save an HTML version. How could I do? I use Node.JS.

I have searched internet but couldn’t find something about it.

First convert the JSON into a ProseMirror document, then use a DOMSerializer to turn that into a DOM structure, then use something like innerHTML to get the HTML text. On node, you’ll need something like jsdom to get a DOM.

Or write your own recursive function that does the conversion directly, of course.

Thanks a lot for your answer! This is very helpful :slight_smile: