how to make richtext output html in json

instead of breaking down to structured data

This is h1 block

instead of

   "content": [
      {
        "type": "heading",
        "attrs": {
          "level": 1
        },
        "content": [
          {
            "text": "This is h1 block",
            "type": "text"
          }
        ]