Install & Compatibility
Where this runs
tested against v1.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.1MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ContentstackUtils
✓ from contentstack_utils import ContentstackUtils
✗ from contentstack_utils import ContentstackUtils
This quickstart demonstrates how to convert a Contentstack Rich Text Editor (RTE) JSON structure into renderable HTML using the `ContentstackUtils.json_to_html` method. This is the most common use case for the library.
import json
from contentstack_utils import ContentstackUtils
# Sample Rich Text Editor JSON from Contentstack
# This structure is typically found under the 'json' key of an RTE field.
rte_content_json = [
{
"type": "doc",
"children": [
{
"type": "p",
"children": [
{
"text": "Hello from Contentstack Rich Text Editor!"
}
]
},
{
"type": "p",
"children": [
{
"type": "a",
"attrs": {
"href": "https://www.contentstack.com",
"target": "_blank",
"rel": ["noopener", "noreferrer"]
},
"children": [
{
"text": "Visit Contentstack"
}
]
}
]
}
]
}
]
# Convert the RTE JSON to HTML
html_output = ContentstackUtils.json_to_html(rte_content_json)
print("Converted HTML output:")
print(html_output)
Debug
Known issues
gotchaThis library only handles processing existing Contentstack data (like RTE content) and does NOT provide functionality for fetching data from Contentstack. You must use the official Contentstack Python SDK or another HTTP client to retrieve entry data first.fixUse the `contentstack-sdk-python` library to fetch content entries from Contentstack, then pass the relevant RTE JSON to `contentstack-utils` for processing.
affects: All versions
breakingVersions 1.1.0 (SRTE Support) and 1.2.1 (GraphQL SRTE support) introduced significant changes to how Rich Text Editor content, especially Supercharged RTE (SRTE) with embedded items, is handled. Existing code that manually parsed or expected a simpler RTE JSON structure might require updates.fixReview the official documentation for SRTE and embedded items. Utilize `ContentstackUtils.json_to_html` with the `Options` class and a `render_embedded_object` callback for proper handling of embedded content in newer RTE fields.
affects: <1.1.0 to >1.1.0
breakingVersion 1.3.0 added 'Reference support', which could alter the structure of RTE JSON when entries contain linked references. If your application was making assumptions about RTE JSON structure, this might cause unexpected behavior.fixEnsure your code is resilient to changes in RTE JSON structure, particularly when dealing with references. Always validate the input to `json_to_html` or use the `Options` class to provide appropriate rendering logic for references.
affects: <1.3.0 to >1.3.0
gotchaSecurity fixes were implemented in versions 1.3.2 and 1.3.3. Older versions may contain unpatched vulnerabilities related to dependencies or parsing logic.fixAlways upgrade to the latest stable version (currently 1.5.0) to ensure you have the most up-to-date security patches and bug fixes.
affects: <1.3.2
Upgrade
Version history
1.5.0latest on PyPI · released Apr 6, 2026
Audit
Dependencies
lxmlrequiredRequired for parsing and rendering HTML from Contentstack's Rich Text Editor JSON.