> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Extract Json • Rust AI Agent SDK

> extract_json: Extract JSON from a string that may contain markdown code blocks

# extract\_json

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**parse\_utils**](../modules/parse_utils) module.

Extract JSON from a string that may contain markdown code blocks

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def extract_json(text: &str) -> Option<&str>
```

## Parameters

<ParamField query="text" type="&str" required={true}>
  No description available.
</ParamField>

### Returns

<ResponseField name="Returns" type="Option<&str>">
  The result of the operation.
</ResponseField>

## Uses

* `trim`
* `find`
* `rfind`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/parity/parse_utils.rs#L246">
  `praisonai/src/parity/parse_utils.rs` at line 246
</Card>
