JSON_EXTRACT
All functions > JSON > JSON_EXTRACT
Returns the value of the given JSON path in the given JSON expression.
Syntax
JSON_EXTRACT(expr, json_path)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
expr | JSON | Yes | The JSON expression to extract from |
json_path | JSON | Yes | The JSON path to extract (e.g., '$.field.subfield') |
Returns
The JSON value at the specified path
Notes
- Extracts values from JSON documents using JSONPath syntax
- Supports nested field access with dot notation ($.field.subfield)
- Supports array indexing ($.array[0])
- Returns JSON type, preserving structure (objects, arrays, etc.)
- Returns NULL if the path doesn't exist
- Use JSON_EXTRACT_SCALAR for string values
- JSONPath starts with $ representing the root