Schema of JSON Rich Text Editor

In the JSON Rich Text Editor, each paragraph is a block; each block is an array; each array has multiple spans of text objects, storing different nodes of text. It returns clean data, making it easier to process in the backend.

The JSON RTE is composed of Blocks that contain text within them. The schema and example for a block within the RTE is as follows:

Schema:

{
    uid: { type: String, required: true },
    type: { type: String, required: true },
    attrs: { type: Object },
    children: { type: Array[id(Block), Text] }
}

Example:

{
    "type": "h1",
    "uid": "3ddd280397cf44bcb8f",
    "attrs": {},
    "children": [
      {
        "text": "Hello World!",
        "bold": true
      },
      {
        "uid": "blta5aa9ca151e65333"
      },
      {
        "text": "Welcome",
        "bold": true
      }
    ]
}

Properties of Blocks within a JSON RTE:

  • uid: Each block can be uniquely identified by a UID.
  • type: Lets the editor know how a block can be rendered.
  • attrs: Contains all the attributes and metadata the current block requires. It also includes all the formatting options and other properties like href for links.

    Note: When you update an existing JSON RTE, you need to pass the dirty attribute for each content block. Set the attribute to true.

  • children: Contains an array of IDs of other components present inside the block, e.g., embedded items, and the text present inside the block.

Additional Resource: You can read more about the schema of the JSON RTE in our documentation where we have covered it extensively.

Was this article helpful?

Thanks for your feedbackSmile-icon

On This Page

^