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

# get_json_double

> Extracts a floating-point value from a JSON string at the specified path.

This function analyzes and gets the floating point value from a specified path in json string. json\_path must start with `$` and use `.` as the path separator.

**Tip**

All of the JSON functions and operators are listed in the navigation and on the [overview page](/documents/4.2/sql-reference/sql-functions/json-functions/overview-of-json-functions-and-operators.md)

Accelerate your queries with [generated columns](/documents/4.2/sql-reference/sql-statements/generated_columns.md)

If the path includes `.`, it could be circled by `"` and `"`.

`[ ]` is used as the array subscripts which start from 0.

Content in the path should not contain `"` , `[` and `]`.

If the format of json\_string or json\_path is wrong, this function will return NULL.

## Syntax

```Haskell theme={null}
DOUBLE get_json_double(VARCHAR json_str, VARCHAR json_path)
```

## Examples

1. Get the value whose key is "k1"

   ```Plain Text theme={null}
   MySQL > SELECT get_json_double('{"k1":1.3, "k2":"2"}', "$.k1");
   +-------------------------------------------------+
   | get_json_double('{"k1":1.3, "k2":"2"}', '$.k1') |
   +-------------------------------------------------+
   |                                             1.3 |
   +-------------------------------------------------+
   ```

2. Get the second element in the array whose key is "my.key"

   ```Plain Text theme={null}
   MySQL > SELECT get_json_double('{"k1":"v1", "my.key":[1.1, 2.2, 3.3]}', '$."my.key"[1]');
   +---------------------------------------------------------------------------+
   | get_json_double('{"k1":"v1", "my.key":[1.1, 2.2, 3.3]}', '$."my.key"[1]') |
   +---------------------------------------------------------------------------+
   |                                                                       2.2 |
   +---------------------------------------------------------------------------+
   ```

3. Get the first element in the array whose path is k1.key -> k2.

   ```Plain Text theme={null}
   MySQL > SELECT get_json_double('{"k1.key":{"k2":[1.1, 2.2]}}', '$."k1.key".k2[0]');
   +---------------------------------------------------------------------+
   | get_json_double('{"k1.key":{"k2":[1.1, 2.2]}}', '$."k1.key".k2[0]') |
   +---------------------------------------------------------------------+
   |                                                                 1.1 |
   +---------------------------------------------------------------------+
   ```

## keyword

GET\_JSON\_DOUBLE,GET,JSON,DOUBLE


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.