> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# strip_json_fence

> Unwrap a fenced JSON code block returned verbatim by the chat engine.

[ref-post-prompt]: /docs/server-sdks/reference/python/core/post-prompt

Unwrap ` ```json ... ``` ` fencing. The chat engine hands the model's answer back verbatim,
fence and all, where the voice engine parses it first. Text without a fence is returned trimmed.

## Parameters

**`text`** `str` — required

The raw string, fenced or not.

---

## Returns

`str` -- The content with any opening and closing fence removed and whitespace trimmed.

## Example

````python {4}
import json
from signalwire.core.post_prompt import strip_json_fence

summary = json.loads(strip_json_fence('```json\n{"intent": "booking"}\n```'))
print(summary["intent"])  # booking
````

Part of the [post-prompt normalization][ref-post-prompt] module.