# Chalk Python SDK Reference: JSON Functions
source: https://docs.chalk.ai/api-docs#section-json-functions

## `json_extract_array(expr, path)`
source: https://docs.chalk.ai/api-docs#json_extract_array

Extract an array from a JSON string feature using a JSONPath expression. The value of the referenced path must be a JSON node containing an array, or a wildcard object match like: $some_path[*].some_object_property.

Only arrays of strings, bools, numbers, and nulls are supported. If the array contains objects, the function will return 'null'.

**Parameters**

- `expr`: `Underscore`
  The JSON string feature to query.
- `path`: `str | Underscore`
  The JSONPath-like expression to extract the array from the JSON feature.

**Examples**

```python
import chalk.functions as F
from chalk.features import _, features
@features
class User:
   id: str
   profile: str
   favorite_categories: list[str] = F.json_extract_array(_.profile, "$.prefs.favorite_categories")
```

## `json_value(expr, path)`
source: https://docs.chalk.ai/api-docs#json_value

Extract structured data from a JSON string feature using a JSONPath expression.

**Parameters**

- `expr`: `Underscore`
  The JSON string feature to query.
- `path`: `str | Underscore`
  The JSONPath-like expression to extract the scalar from the JSON feature.

**Examples**

```python
import chalk.functions as F
from chalk.features import _, features
from dataclasses import dataclass
@dataclass
class Message:
   content: str
   sender: str
   comments: List[str]
@features
class User:
   id: str
   profile: str
   favorite_color: str = F.json_value(_.profile, "$.prefs.color")
   messages: List[Message] = F.json_value(_.profile, "$.messages")
```

## `jsonify(expr)`
source: https://docs.chalk.ai/api-docs#jsonify

Convert an arbitrary value into a JSON string.

**Parameters**

- `expr`: `Underscore`
  The value to jsonify.

**Examples**

```python
import chalk.functions as F
from chalk.features import _, features
@features
class User:
   id: str
   profile: str
   info_as_json: str = F.jsonify(F.struct_pack({"id": _.id, "profile": _.profile}))
```
