Issue and solution with generate tiptap editor compatible output

This post is trying to discuss how to display ChatGPT output in a frontend editor named Tiptap.

The problem:
Normally I use json as the data format to store document that displayed by Tiptap.
However, I have not found any way to directly generate Tiptap compatible json using ChatGPT API. And also json output might might be expensive given the existence of the formatting has more characters (eg. the curly brackets and data types).

My solution
As a workaround, here is what I did:

  1. Use ChatGPT to generate output in markdown format
  2. Load the markdown using tiptap
  3. Save the content to json using tiptap

It works, but kind of tricky given the conversion of data format in the frontend.

So I am trying to figure out if I missed anything and what is the current best practice to display ChatGPT output to an editor like tiptap.
Does anyone encounter a similar issue? What is your solution?
Thanks in advance!