This is an automated email from the ASF dual-hosted git repository.
mrhhsg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new 84f9179ce38 update json functions' document (#2640)
84f9179ce38 is described below
commit 84f9179ce3812bf2ebd606d4fd355ca8325ebd0d
Author: Jerry Hu <[email protected]>
AuthorDate: Fri Jul 18 15:52:47 2025 +0800
update json functions' document (#2640)
## Versions
- [x] dev
- [ ] 3.0
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../json-functions/json-contains.md | 131 +++++++------
.../json-functions/json-exists-path.md | 93 +++++-----
.../json-functions/json-extract-largeint.md | 1 +
.../scalar-functions/json-functions/json-insert.md | 2 +-
.../scalar-functions/json-functions/json-keys.md | 172 ++++++++++--------
.../scalar-functions/json-functions/json-length.md | 151 +++++++++------
.../json-functions/json-parse-error-to-invalid.md | 7 -
.../json-functions/json-parse-error-to-null.md | 2 +
.../json-functions/json-parse-error-to-value.md | 2 +
.../json-parse-notnull-error-to-invalid.md | 46 -----
.../json-parse-notnull-error-to-value.md | 48 -----
.../json-functions/json-parse-notnull.md | 7 -
.../json-parse-nullable-error-to-invalid.md | 76 --------
.../json-parse-nullable-error-to-null.md | 79 --------
.../json-parse-nullable-error-to-value.md | 71 --------
.../json-functions/json-parse-nullable.md | 59 ------
.../scalar-functions/json-functions/json-quote.md | 125 ++++++++-----
.../json-functions/json-unquote.md | 184 +++++++++----------
.../json-functions/json-contains.md | 167 ++++++++---------
.../json-functions/json-exists-path.md | 93 +++++-----
.../json-functions/json-extract-bigint.md | 1 +
.../json-functions/json-extract-bool.md | 3 +-
.../json-functions/json-extract-largeint.md | 1 +
.../json-functions/json-extract.md | 22 +--
.../scalar-functions/json-functions/json-insert.md | 2 +-
.../scalar-functions/json-functions/json-keys.md | 202 ++++++++++-----------
.../scalar-functions/json-functions/json-length.md | 145 +++++++++------
.../json-functions/json-parse-error-to-invalid.md | 7 -
.../json-functions/json-parse-error-to-null.md | 2 +
.../json-functions/json-parse-error-to-value.md | 2 +
.../json-parse-notnull-error-to-invalid.md | 47 -----
.../json-parse-notnull-error-to-value.md | 48 -----
.../json-functions/json-parse-notnull.md | 7 -
.../json-parse-nullable-error-to-invalid.md | 71 --------
.../json-parse-nullable-error-to-null.md | 78 --------
.../json-parse-nullable-error-to-value.md | 75 --------
.../json-functions/json-parse-nullable.md | 58 ------
.../scalar-functions/json-functions/json-quote.md | 124 ++++++++-----
.../json-functions/json-replace.md | 2 +-
.../scalar-functions/json-functions/json-search.md | 4 +-
.../scalar-functions/json-functions/json-set.md | 2 +-
.../json-functions/json-unquote.md | 165 ++++++++---------
.../scalar-functions/json-functions/json-valid.md | 71 ++++----
sidebars.json | 9 +-
44 files changed, 1025 insertions(+), 1639 deletions(-)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-contains.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-contains.md
index 9c8d91bf1fc..d1703f8a11e 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-contains.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-contains.md
@@ -7,62 +7,89 @@
## Description
-This function is used to check whether a JSON document contains a specified
JSON element. If the specified element exists in the JSON document, it returns
1; otherwise, it returns 0. If the JSON document or the queried element is
invalid, it returns `NULL`.
+Used to determine whether a JSON document contains a specified JSON element.
If the specified element exists in the JSON document, it returns 1, otherwise
it returns 0. If the JSON document or the queried element is invalid, it
returns `NULL`.
## Syntax
-`JSON_CONTAINS(<json_str>, <candidate> [, <json_path>])`
-
-## Required Parameters
-
-| Parameter | Description |
-|-------------|-----------------------------------------------------|
-| `<json_str>` | The JSON string to be checked. |
-| `<candidate>` | The JSON element to check for inclusion. |
-
-## Optional Parameters
-
-| Parameter | Description |
-|-------------|-----------------------------------------------------|
-| `<json_path>` | An optional JSON path to specify the subdocument to check.
If not provided, the root document is used by default. |
-
-## Return Value
-- If `<json_path>` exists in `json_doc`, it returns 1.
-- If `<json_path>` does not exist in `json_doc`, it returns 0.
-- If any parameter is invalid or the JSON document format is incorrect, it
returns `NULL`.
-
-## Examples
-
-```sql
-
-SELECT JSON_CONTAINS('{"a": 1, "b": 2, "c": {"d": 4}}', '1', '$.a');
-
-```
-
```sql
-+------------------------------------------------------------------------------------------+
-| json_contains(cast('{"a": 1, "b": 2, "c": {"d": 4}}' as JSON), cast('1' as
JSON), '$.a') |
-+------------------------------------------------------------------------------------------+
-|
1 |
-+------------------------------------------------------------------------------------------+
-
+JSON_CONTAINS(<json_object>, <candidate>[, <json_path>])
```
+## Parameters
+### Required Parameters
+- `<json_object>` JSON type, check whether `<candidate>` exists in it.
+- `<candidate>` JSON type, the candidate value to be determined.
+### Optional Parameters
+- `<json_path>` String type, the search starting path. If not provided, it
starts from root by default.
-```sql
-
-SELECT json_contains('[1, 2, {"x": 3}]', '1');
-
-```
-
-```sql
-+-------------------------------------------------------------------------+
-| json_contains(cast('[1, 2, {"x": 3}]' as JSON), cast('1' as JSON), '$') |
-+-------------------------------------------------------------------------+
-| 1 |
-+-------------------------------------------------------------------------+
-
-```
-
-
-
+## Return Value
+- Null: If any of the three parameters is NULL, returns NULL
+- True: If `<json_object>` contains `<candidate>`, returns True.
+- False: If `<json_object>` does not contain `<candidate>`, returns False.
+- If `<json_object>` or `<candidate>` is not a JSON type, an error is reported.
+
+## Examples
+1. Example 1
+ ```sql
+ SET @j = '{"a": 1, "b": 2, "c": {"d": 4}}';
+ SET @j2 = '1';
+ SELECT JSON_CONTAINS(@j, @j2, '$.a');
+ ```
+ ```text
+ +-------------------------------+
+ | JSON_CONTAINS(@j, @j2, '$.a') |
+ +-------------------------------+
+ | 1 |
+ +-------------------------------+
+ ```
+ ```sql
+ SELECT JSON_CONTAINS(@j, @j2, '$.b');
+ ```
+ ```text
+ +-------------------------------+
+ | JSON_CONTAINS(@j, @j2, '$.b') |
+ +-------------------------------+
+ | 0 |
+ +-------------------------------+
+ ```
+ ```sql
+ SELECT JSON_CONTAINS(@j, '{"a": 1}');
+ ```
+ ```text
+ +-------------------------------+
+ | JSON_CONTAINS(@j, '{"a": 1}') |
+ +-------------------------------+
+ | 1 |
+ +-------------------------------+
+ ```
+2. NULL parameters
+ ```sql
+ SELECT JSON_CONTAINS(NULL, '{"a": 1}');
+ ```
+ ```text
+ +---------------------------------+
+ | JSON_CONTAINS(NULL, '{"a": 1}') |
+ +---------------------------------+
+ | NULL |
+ +---------------------------------+
+ ```
+ ```sql
+ SELECT JSON_CONTAINS('{"a": 1}', NULL);
+ ```
+ ```text
+ +---------------------------------+
+ | JSON_CONTAINS('{"a": 1}', NULL) |
+ +---------------------------------+
+ | NULL |
+ +---------------------------------+
+ ```
+ ```sql
+ SELECT JSON_CONTAINS('{"a": 1}', '{"a": 1}', NULL);
+ ```
+ ```text
+ +---------------------------------------------+
+ | JSON_CONTAINS('{"a": 1}', '{"a": 1}', NULL) |
+ +---------------------------------------------+
+ | NULL |
+ +---------------------------------------------+
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-exists-path.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-exists-path.md
index d2db22a1582..a8c4342538a 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-exists-path.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-exists-path.md
@@ -7,57 +7,64 @@
## Description
-It is used to judge whether the field specified by json_path exists in the
JSON data. If it exists, it returns TRUE, and if it does not exist, it returns
FALSE
+Used to determine whether the field specified by `<path>` exists in JSON data.
Returns TRUE if it exists, FALSE if it does not exist.
## Syntax
```sql
-JSON_EXISTS_PATH (<json_str>, <path>)
+JSON_EXISTS_PATH (<json_object>, <path>)
```
-## Alias
-
-* JSONB_EXISTS_PATH
-
## Parameters
-| Parameter | Description
|
-|--------------|--------------------------------------------------------|
-| `<json_str>` | The element to be included in the JSON array. It can be a
value of any type, including NULL. If no element is specified, an empty array
is returned.
-| `<path>` | The JSON path to be judged. If it is NULL, then return NULL.
|
+- `<json_object>` JSON type, determine whether the path specified by `<path>`
exists in it.
+- `<path>` String type, specifies the path.
-## Return Values
-If it exists, return TRUE; if it does not exist, return FALSE.
+## Return Value
+- BOOL type, returns TRUE if it exists, FALSE if it does not exist
+- NULL: If either `<json_object>` or `<path>` is NULL, returns NULL.
## Examples
-
-```sql
-SELECT JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.name');
-```
-```text
-+---------------------------------------------------------------------------+
-| jsonb_exists_path(cast('{"id": 123, "name": "doris"}' as JSON), '$.name') |
-+---------------------------------------------------------------------------+
-| 1 |
-+---------------------------------------------------------------------------+
-```
-```sql
-SELECT JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.age');
-```
-```text
-+--------------------------------------------------------------------------+
-| jsonb_exists_path(cast('{"id": 123, "name": "doris"}' as JSON), '$.age') |
-+--------------------------------------------------------------------------+
-| 0 |
-+--------------------------------------------------------------------------+
-```
-```sql
-SELECT JSONB_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.age');
-```
-```text
-+--------------------------------------------------------------------------+
-| jsonb_exists_path(cast('{"id": 123, "name": "doris"}' as JSON), '$.age') |
-+--------------------------------------------------------------------------+
-| 0 |
-+--------------------------------------------------------------------------+
-```
+1. Example 1
+ ```sql
+ SELECT JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.name');
+ ```
+ ```text
+ +------------------------------------------------------------+
+ | JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.name') |
+ +------------------------------------------------------------+
+ | 1 |
+ +------------------------------------------------------------+
+ ```
+2. Example 2
+ ```sql
+ SELECT JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.age');
+ ```
+ ```text
+ +-----------------------------------------------------------+
+ | JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.age') |
+ +-----------------------------------------------------------+
+ | 0 |
+ +-----------------------------------------------------------+
+ ```
+3. NULL parameters
+ ```sql
+ SELECT JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', NULL);
+ ```
+ ```text
+ +--------------------------------------------------------+
+ | JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', NULL) |
+ +--------------------------------------------------------+
+ | NULL |
+ +--------------------------------------------------------+
+ ```
+ ```sql
+ SELECT JSON_EXISTS_PATH(NULL, '$.age');
+ ```
+ ```text
+ +---------------------------------+
+ | JSON_EXISTS_PATH(NULL, '$.age') |
+ +---------------------------------+
+ | NULL |
+ +---------------------------------+
+ ```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-largeint.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-largeint.md
index f9b09a658b6..eaabe03b41c 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-largeint.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-largeint.md
@@ -34,6 +34,7 @@ JSON_EXTRACT_LARGEINT(<json_object>, <json_path>)
```sql
SELECT json_extract_largeint('{"id": 11529215046068469760, "name":
"doris"}', '$.id');
```
+ ```text
+--------------------------------------------------------------------------------+
| json_extract_largeint('{"id": 11529215046068469760, "name": "doris"}',
'$.id') |
+--------------------------------------------------------------------------------+
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-insert.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-insert.md
index 63a0536f0f1..038fcc05743 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-insert.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-insert.md
@@ -19,7 +19,7 @@ JSON_INSERT (<json_object>, <path>, <value>[, <path>,
<value>, ...])
- `<value>`: JSON type or other types supported by [`TO_JSON`](./to-json.md),
the value to be inserted.
## Return Value
-- Nullable(JSON) Returns the modified JSON object
+- `Nullable(JSON)` Returns the modified JSON object
## Usage Notes
1. Note that path-value pairs are evaluated from left to right.
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-keys.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-keys.md
index 78fc21dbc32..a86b336c766 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-keys.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-keys.md
@@ -6,88 +6,114 @@
---
## Description
-
-Used to return the key from the top-level value of a JSON object. These keys
are returned as an array or, if path parameters are given, the top-level keys
of the selected path. You need to provide the JSON document as an argument to
the function. You can also (optionally) provide a second parameter to specify
where the "top-level" path in the JSON document starts.
-Where json_doc is a JSON document, and path is an optional parameter used to
determine where the "top-level" path in the JSON document starts.
+Returns all keys of a JSON object in array form. By default, it returns the
keys of the root object, but you can also control which specific path's object
keys to return through parameters.
## Syntax
-`JSON_KEYS(<str> [, <path>])`
-
-## Alias
-
-- JSONB_KEYS
+```sql
+JSON_KEYS(<json_object>[, <path>])
+```
-## Required Parameters
-| parameters| described|
-|------|------|
-| `<str>`| A JSON string from which to extract the key is needed. |
+## Parameters
+### Required Parameters
+- `<json_object>` JSON type, the JSON object from which keys need to be
extracted.
-## Optional Parameters
-| parameters| described|
-|------|------|
-| `<path>`| Optional JSON path that specifies the JSON subdocument to be
checked. If it is not provided, the default is the root document. |
+### Optional Parameters
+- `<path>` String type, optional JSON path that specifies the JSON subdocument
to check. If not provided, defaults to the root document.
## Return Value
+- Array<String> Returns an array of strings, where the array members are all
the keys of the JSON object.
-- Returns a list of key names (a array) for the JSON document.
-- Returns NULL if `<str>` is not a valid JSON object.
-- If the JSON object has no keys, an empty array is returned.
-
-## Usage Notes
-
-- If the selected object is empty, the result array is empty. If the top-level
value contains nested sub-objects, the return value does not include the keys
of those sub-objects.
+## Notes
+- Returns NULL when `<json_object>` or `<path>` is NULL.
+- Returns NULL if it's not a JSON object (e.g., if it's a JSON array).
+- Returns NULL if the object pointed to by `<path>` does not exist.
## Examples
+1. Example 1
+ ```sql
+ SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}');
+ ```
+ ```text
+ +---------------------------------------+
+ | JSON_KEYS('{"a": 1, "b": {"c": 30}}') |
+ +---------------------------------------+
+ | ["a", "b"] |
+ +---------------------------------------+
+ ```
+ ```sql
+ SELECT JSON_KEYS('{}');
+ ```
+ ```text
+ +-----------------+
+ | JSON_KEYS('{}') |
+ +-----------------+
+ | [] |
+ +-----------------+
+ ```
-```sql
-SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}');
-```
-```sql
-+-----------------------------------------------------+
-| json_keys(cast('{"a": 1, "b": {"c": 30}}' as JSON)) |
-+-----------------------------------------------------+
-| ["a", "b"] |
-+-----------------------------------------------------+
-```
-```sql
-SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}', '$.b');
-```
-```sql
-+------------------------------------------------------------+
-| json_keys(cast('{"a": 1, "b": {"c": 30}}' as JSON), '$.b') |
-+------------------------------------------------------------+
-| ["c"] |
-+------------------------------------------------------------+
-```
-```sql
-SELECT JSON_KEYS('{}');
-```
-```sql
-+-------------------------------+
-| json_keys(cast('{}' as JSON)) |
-+-------------------------------+
-| [] |
-+-------------------------------+
-```
-```sql
-SELECT JSON_KEYS('[1,2]');
-```
-```sql
-+----------------------------------+
-| json_keys(cast('[1,2]' as JSON)) |
-+----------------------------------+
-| NULL |
-+----------------------------------+
-```
-```sql
- SELECT JSON_KEYS('[]');
- ```
- ```sql
-+-------------------------------+
-| json_keys(cast('[]' as JSON)) |
-+-------------------------------+
-| NULL |
-+-------------------------------+
-```
\ No newline at end of file
+2. Specify path
+ ```sql
+ SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}', '$.b');
+ ```
+ ```text
+ +----------------------------------------------+
+ | JSON_KEYS('{"a": 1, "b": {"c": 30}}', '$.b') |
+ +----------------------------------------------+
+ | ["c"] |
+ +----------------------------------------------+
+ ```
+3. NULL parameters
+ ```sql
+ SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}', NULL);
+ ```
+ ```text
+ +---------------------------------------------+
+ | JSON_KEYS('{"a": 1, "b": {"c": 30}}', NULL) |
+ +---------------------------------------------+
+ | NULL |
+ +---------------------------------------------+
+ ```
+ ```sql
+ SELECT JSON_KEYS(NULL);
+ ```
+ ```text
+ +-----------------+
+ | JSON_KEYS(NULL) |
+ +-----------------+
+ | NULL |
+ +-----------------+
+ ```
+4. Not a JSON object
+ ```sql
+ SELECT JSON_KEYS('[1,2]');
+ ```
+ ```text
+ +--------------------+
+ | JSON_KEYS('[1,2]') |
+ +--------------------+
+ | NULL |
+ +--------------------+
+ ```
+ ```sql
+ SELECT JSON_KEYS('{"k": [1, 2, 3]}', '$.k');
+ ```
+ ```text
+ +--------------------------------------+
+ | JSON_KEYS('{"k": [1, 2, 3]}', '$.k') |
+ +--------------------------------------+
+ | NULL |
+ +--------------------------------------+
+ ```
+5. Object specified by path does not exist
+ ```sql
+ SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}', '$.c');
+ ```
+ ```text
+ +----------------------------------------------+
+ | JSON_KEYS('{"a": 1, "b": {"c": 30}}', '$.c') |
+ +----------------------------------------------+
+ | NULL |
+ +----------------------------------------------+
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-length.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-length.md
index 7ea68b370af..01ae971f521 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-length.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-length.md
@@ -6,68 +6,115 @@
---
## Description
-The JSON_LENGTH function returns the length or number of elements of a given
JSON document. If the JSON document is an array, the number of elements in the
array is returned; if the JSON document is an object, the number of key-value
pairs in the object is returned. Returns NULL if the JSON document is empty or
invalid.
+The `JSON_LENGTH` function is used to return the length or number of elements
in a given JSON document. If the JSON document is an array, it returns the
number of elements in the array; if the JSON document is an object, it returns
the number of key-value pairs in the object. If the JSON document is invalid,
it returns `NULL`.
## Syntax
```sql
-JSON_LENGTH(<json_str> [ , <json_path> ])
+JSON_LENGTH(<json_object> [, <path>])
```
-## Required Parameters
+## Parameters
+### Required Parameters
+- `<json_object>` JSON type, the JSON document whose length is to be returned.
-| parameters| described|
-|------|------|
-| `<json_str>`| The length of the JSON string needs to be checked. |
+### Optional Parameters
+- `<path>` String type, used to return the length of a specific object in the
document.
-## Optional Parameters
-| parameters| described|
-|------|------|
-| `<json_path>`| If a path is specified, the JSON_LENGTH() function returns
the length of the data that matches the path in the JSON document, otherwise it
returns the length of the JSON document|
-
-## Usage Notes
-This function calculates the length of a JSON document based on the following
rules:
-- The length of the scalar is 1. For example: '1','"x "','true',' false', and
'null' are all of length 1.
-- The length of an array is the number of array elements. For example: '[1,2]'
has length 2.
-- The length of an object is the number of object members. For example: '{"x":
1}' has length 1
+## Notes
+This function calculates the length of a JSON document according to the
following rules:
+- The length of a scalar is 1. For example: '1', '"x"', 'true', 'false',
'null' all have a length of 1.
+- The length of an array is the number of array elements. For example: '[1,
2]' has a length of 2.
+- The length of an object is the number of object members. For example: '{"x":
1, "y": [1, 2, 3]}' has a length of 2.
## Return Value
-
-- For a JSON array, returns the number of elements in the array.
+- For JSON arrays, returns the number of elements in the array.
- For JSON objects, returns the number of key-value pairs in the object.
-- Returns NULL for invalid JSON strings.
-- For other types (such as strings, numbers, booleans, null, etc.), NULL is
returned.
+- For JSON scalar types (such as strings, numbers, booleans, null, etc.),
returns 1.
+- For invalid JSON strings, returns NULL.
## Examples
-
-```sql
-SELECT json_length('{"k1":"v31","k2":300}');
-```
-
-```sql
-+--------------------------------------+
-| json_length('{"k1":"v31","k2":300}') |
-+--------------------------------------+
-| 2 |
-+--------------------------------------+
-```
-```sql
-SELECT json_length('"abc"');
-```
-```sql
-+----------------------+
-| json_length('"abc"') |
-+----------------------+
-| 1 |
-+----------------------+
-```
-```sql
-SELECT json_length('{"x": 1, "y": [1, 2]}', '$.y');
-```
-```sql
-+---------------------------------------------+
-| json_length('{"x": 1, "y": [1, 2]}', '$.y') |
-+---------------------------------------------+
-| 2 |
-+---------------------------------------------+
-```
\ No newline at end of file
+1. Example 1
+ ```sql
+ SELECT json_length('{"k1":"v31","k2":300}');
+ ```
+ ```text
+ +--------------------------------------+
+ | json_length('{"k1":"v31","k2":300}') |
+ +--------------------------------------+
+ | 2 |
+ +--------------------------------------+
+ ```
+ ```sql
+ SELECT json_length('[1, 2, 3, 4, 5, 6]');
+ ```
+ ```text
+ +-----------------------------------+
+ | json_length('[1, 2, 3, 4, 5, 6]') |
+ +-----------------------------------+
+ | 6 |
+ +-----------------------------------+
+ ```
+2. Length of scalar types
+ ```sql
+ SELECT json_length('"abc"');
+ ```
+ ```text
+ +----------------------+
+ | json_length('"abc"') |
+ +----------------------+
+ | 1 |
+ +----------------------+
+ ```
+ ```sql
+ SELECT json_length('123');
+ ```
+ ```text
+ +--------------------+
+ | json_length('123') |
+ +--------------------+
+ | 1 |
+ +--------------------+
+ ```
+ ```sql
+ SELECT json_length('{"k": null}');
+ ```
+ ```text
+ +----------------------------+
+ | json_length('{"k": null}') |
+ +----------------------------+
+ | 1 |
+ +----------------------------+
+ ```
+3. Specify path
+ ```sql
+ SELECT json_length('{"x": 1, "y": [1, 2]}', '$.y');
+ ```
+ ```text
+ +---------------------------------------------+
+ | json_length('{"x": 1, "y": [1, 2]}', '$.y') |
+ +---------------------------------------------+
+ | 2 |
+ +---------------------------------------------+
+ ```
+4. NULL parameters
+ ```sql
+ SELECT json_length('{"x": 1, "y": [1, 2]}', NULL);
+ ```
+ ```text
+ +--------------------------------------------+
+ | json_length('{"x": 1, "y": [1, 2]}', NULL) |
+ +--------------------------------------------+
+ | NULL |
+ +--------------------------------------------+
+ ```
+ ```sql
+ SELECT json_length(NULL, '$.y');
+ ```
+ ```text
+ +--------------------------+
+ | json_length(NULL, '$.y') |
+ +--------------------------+
+ | NULL |
+ +--------------------------+
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-invalid.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-invalid.md
deleted file mode 100644
index 12b55188d80..00000000000
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-invalid.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-{
- "title": "JSON_PARSE_ERROR_TO_INVALID",
- "language": "en"
-}
----
-
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-null.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-null.md
index 06262464140..d0dfd54e8bb 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-null.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-null.md
@@ -5,3 +5,5 @@
}
---
+## Description
+A variant of the [`JSON_PARSE`](./json-parse.md) function.
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-value.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-value.md
index c93bbb42661..4983a3b5c89 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-value.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-value.md
@@ -5,3 +5,5 @@
}
---
+## Description
+A variant of the [`JSON_PARSE`](./json-parse.md) function.
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-invalid.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-invalid.md
deleted file mode 100644
index e21e5aae98e..00000000000
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-invalid.md
+++ /dev/null
@@ -1,46 +0,0 @@
----
-{
- "title": "JSON_PARSE_NOTNULL_ERROR_TO_INVALID",
- "language": "en"
-}
----
-
-## Description
-
-This function is used to parse a JSON string. If the JSON string is malformed
or a parsing error occurs, the function will return an invalid JSON object
(usually `{}`). The main purpose of this function is to ensure that when a JSON
format error occurs, a safe default value is returned, preventing query
failures due to parsing errors.
-
-## Aliases
-
-- JSONB_PARSE_NOTNULL_ERROR_TO_INVALID
-
-## Syntax
-
-```sql
-JSON_PARSE_NOTNULL_ERROR_TO_INVALID( <str> )
-```
-
-## Required Parameters
-
-| parameters| described|
-|------|------|
-| `<str>`| The JSON string to be parsed. This parameter should be a valid
string containing JSON-formatted data. If the JSON format is invalid, the
function will return an invalid JSON object. |
-
-## Return Value
-Returns an invalid JSON object (usually `{}`).
-
-## Examples
-
-```sql
-
-SELECT JSON_PARSE_NOTNULL_ERROR_TO_INVALID('{"name": "Alice", "age": 30}') AS
parsed_json;
-
-```
-
-```sql
-+---------------------------+
-| parsed_json |
-+---------------------------+
-| {"name":"Alice","age":30} |
-+---------------------------+
-
-```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-value.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-value.md
deleted file mode 100644
index dc84c95e420..00000000000
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-value.md
+++ /dev/null
@@ -1,48 +0,0 @@
----
-{
- "title": "JSON_PARSE_NOTNULL_ERROR_TO_VALUE",
- "language": "en"
-}
----
-
-## Description
-
-Function to parse JSON strings. If the JSON string format is invalid or a
parsing error occurs, the function returns the default value specified by the
user instead of returning an invalid JSON object. The main purpose of this
function is to provide a default value that can be used to replace invalid
results in case of parsing errors, ensuring that the query returns a reasonable
value.
-
-## Syntax
-
-```sql
-JSON_PARSE_NOTNULL_ERROR_TO_VALUE(< str >, <default_value>)
-```
-
-## Alias
-
-- JSONB_PARSE_NOTNULL_ERROR_TO_VALUE
-
-## Required Parameters
-
-| parameters| described|
-|------|------|
-| `<str>` | The JSON string to parse. This parameter should be a valid JSON
string. If the JSON format is invalid, the function returns default_value. |
-| `<default_value>` | The default value returned when parsing the error. This
parameter can be of any type and is used to replace invalid JSON-formatted
data. |
-
-
-## Return Value
-
-Return a JSON object. If the input JSON string is valid, the parsed JSON
object is returned. If invalid, return the user-specified default_value.
-
-
-## Examples
-
-```sql
-SELECT JSON_PARSE_NOTNULL_ERROR_TO_VALUE('{"name": "Alice", "age": 30}',
'{"name": "Unknown", "age": 0}') AS parsed_json;
-
-```
-
-```sql
-+-------------------------------------------+
-| parsed_json |
-+-------------------------------------------+
-| {"name":"Alice","age":30} |
-+-------------------------------------------+
-```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull.md
deleted file mode 100644
index 4a15205e77a..00000000000
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-{
- "title": "JSON_PARSE_NOTNULL",
- "language": "en"
-}
----
-
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-invalid.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-invalid.md
deleted file mode 100644
index e8f703020fd..00000000000
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-invalid.md
+++ /dev/null
@@ -1,76 +0,0 @@
----
-{
- "title": "JSON_PARSE_NULLABLE_ERROR_TO_INVALID",
- "language": "en"
-}
----
-
-## Description
-
-The `JSON_PARSE_NULLABLE_ERROR_TO_INVALID` function is used to parse a JSON
string into a valid JSON object. If the input JSON string is invalid, it will
return an "invalid JSON" marker (typically `INVALID_JSON`), without throwing an
error. If the input is `NULL`, it will also return the `INVALID_JSON` marker.
-
-## Syntax
-
-```sql
-JSON_PARSE_NULLABLE_ERROR_TO_INVALID( <str> )
-```
-
-## Alias
-
-- JSONB_PARSE_NULLABLE_ERROR_TO_INVALID
-
-
-## Required Parameters
-
-| Parameter | Description |
-|-----------|---------------------------------------------------------|
-| `<str>` | The input string in JSON format to be parsed. |
-
-## Return Value
-
-| Condition | Return Value
|
-|-----------------------------------------|------------------------------------|
-| If the input string is a valid JSON | It returns the corresponding JSON
object. |
-| If the input string is invalid or NULL | It returns the `INVALID_JSON`
marker. |
-
-## Examples
-1. Valid JSON string:
-
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_INVALID('{"name": "John", "age": 30}');
-```
-
-```sql
-+----------------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_INVALID('{"name": "John", "age": 30}') |
-+----------------------------------------------------------------------+
-| {"name": "John", "age": 30} |
-+----------------------------------------------------------------------+
-```
-
-2. Invalid JSON string:
-
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_INVALID('{"name": "John", "age": }');
-```
-
-```sql
-+-------------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_INVALID('{"name": "John", "age": }') |
-+-------------------------------------------------------------------+
-| INVALID_JSON |
-+-------------------------------------------------------------------+
-```
-3. Input is NULL:
-
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_INVALID(NULL);
-```
-
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_INVALID(NULL) |
-+---------------------------------------------------------------+
-| INVALID_JSON |
-+---------------------------------------------------------------+
-```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-null.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-null.md
deleted file mode 100644
index 963b87a0d89..00000000000
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-null.md
+++ /dev/null
@@ -1,79 +0,0 @@
----
-{
- "title": "JSON_PARSE_NULLABLE_ERROR_TO_NULL",
- "language": "en"
-}
----
-
-## Description
-
-The `JSON_PARSE_NULLABLE_ERROR_TO_NULL` function is used to parse a JSON
string into a valid JSON object. If the input JSON string is invalid, it will
return `NULL` without throwing an error. If the input is `NULL`, it will
directly return `NULL`.
-
-## Syntax
-
-```sql
-JSON_PARSE_NULLABLE_ERROR_TO_NULL( <str> )
-```
-## Aliases
-
-- JSONB_PARSE_NULLABLE_ERROR_TO_NULL
-
-## Required Parameters
-
-| Parameter | Description |
-|-----------|---------------------------------------------------------|
-| `<str>` | The input string in JSON format to be parsed. |
-
-## Return Value
-
-If the input string is a valid JSON, it returns the corresponding JSON object.
-If the input string is invalid or NULL, it returns NULL.
-
-## Examples
-
-1. Valid JSON string:
-
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_NULL('{"name": "John", "age": 30}');
-
-```
-
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_NULL('{"name": "John", "age": 30}') |
-+---------------------------------------------------------------+
-| {"name": "John", "age": 30} |
-+---------------------------------------------------------------+
-
-```
-2. Invalid JSON string:
-
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_NULL('{"name": "John", "age": }');
-
-```
-
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_NULL('{"name": "John", "age": }') |
-+---------------------------------------------------------------+
-| NULL |
-+---------------------------------------------------------------+
-
-```
-3. Input is NULL:
-
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_NULL(NULL);
-
-```
-
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_NULL(NULL) |
-+---------------------------------------------------------------+
-| NULL |
-+---------------------------------------------------------------+
-
-```
-
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-value.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-value.md
deleted file mode 100644
index 833c380dcef..00000000000
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-value.md
+++ /dev/null
@@ -1,71 +0,0 @@
----
-{
- "title": "JSON_PARSE_NULLABLE_ERROR_TO_VALUE",
- "language": "en"
-}
----
-
-## Description
-
-The `JSON_PARSE_NULLABLE_ERROR_TO_VALUE` function is used to parse a JSON
string into a valid JSON object. If the input JSON string is invalid, it will
return the default value specified by the user, instead of throwing an error.
If the input is `NULL`, it will return the default value.
-
-## Syntax
-
-```sql
-JSON_PARSE_NULLABLE_ERROR_TO_VALUE( <str> , <default_value>)
-```
-## Aliases
-- JSONB_PARSE_NULLABLE_ERROR_TO_VALUE
-
-## Required Parameters
-
-| parameters| described|
-|------|------|
-| `<str>` | The input string in JSON format to be parsed. |
-| `<default_value>` | The default value returned when parsing fails. |
-
-## Return Value
-If the input string is a valid JSON, it returns the corresponding JSON object.
-If the input string is invalid or NULL, it returns the default value specified
by the default_value parameter.
-
-## Examples
-
-1. Valid JSON string:
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_VALUE('{"name": "John", "age": 30}',
'default');
-```
-
-```sql
-+------------------------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_VALUE('{"name": "John", "age": 30}', 'default')
|
-+------------------------------------------------------------------------------+
-| {"name": "John", "age": 30}
|
-+------------------------------------------------------------------------------+
-```
-
-2. Invalid JSON string:
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_VALUE('{"name": "John", "age": }',
'default');
-```
-
-```sql
-+----------------------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_VALUE('{"name": "John", "age": }', 'default') |
-+----------------------------------------------------------------------------+
-| default |
-+----------------------------------------------------------------------------+
-```
-
-3. Input is NULL:
-
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_VALUE(NULL, 'default');
-```
-
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_VALUE(NULL, 'default') |
-+---------------------------------------------------------------+
-| default |
-+---------------------------------------------------------------+
-```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable.md
deleted file mode 100644
index 0e481b5e736..00000000000
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable.md
+++ /dev/null
@@ -1,59 +0,0 @@
----
-{
- "title": "JSON_PARSE_NULLABLE",
- "language": "en"
-}
----
-
-## Description
-
-The `JSON_PARSE_NULLABLE` function is used to parse a JSON string into a valid
JSON object. If the input string is invalid or NULL, it returns NULL without
throwing an error.
-
-## Syntax
-
-```sql
-JSON_PARSE_NULLABLE( <str> )
-
-```
-## Alias
-
-- JSONB_PARSE_NULLABLE
-
-## Required Parameters
-
-| Parameter | Description |
-|------|------|
-| `<str>` | The input string in JSON format to be parsed. |
-
-## Return Value
-- If the input string is valid JSON, it returns the corresponding JSON object.
-- If the input string is invalid or NULL, it returns NULL.
-
-## Examples
-
-1.Valid JSON string:
-```sql
-SELECT JSON_PARSE_NULLABLE('{"name": "John", "age": 30}');
-```
-
-```sql
-+-------------------------------------------------------+
-| JSON_PARSE_NULLABLE('{"name": "John", "age": 30}') |
-+-------------------------------------------------------+
-| {"name": "John", "age": 30} |
-+-------------------------------------------------------+
-
-```
-2.Invalid JSON string:
-```sql
-SELECT JSON_PARSE_NULLABLE('{"name": "John", "age": }');
-```
-
-```sql
-+-------------------------------------------------------+
-| JSON_PARSE_NULLABLE('{"name": "John", "age": }') |
-+-------------------------------------------------------+
-| NULL |
-+-------------------------------------------------------+
-
-```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-quote.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-quote.md
index a1f7a25e676..6c762a2effa 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-quote.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-quote.md
@@ -6,62 +6,89 @@
---
## Description
-Enclose json_value in double quotes ("), escape special characters contained.
+Surrounds the input string parameter with double quotes and escapes special
characters and control characters in the string. The main purpose of this
function is to convert strings into valid JSON strings.
+
+Special characters include:
+* Quote (`"`)
+* Backslash (`\`)
+* Backspace (`\b`)
+* Newline (`\n`)
+* Carriage return (`\r`)
+* Horizontal tab (`\t`)
+
+Control characters include:
+* `CHAR(0)` is escaped as `\u0000`
## Syntax
```sql
-JSON_QUOTE (<a>)
+JSON_QUOTE (<str>)
```
## Parameters
+`<str>` String type, the value to be quoted.
-| Parameter | Description |
-|-----------|------------------------------------------|
-| `<a>` | The value of the json_value to be enclosed. |
+## Return Value
+Returns a string enclosed in double quotes
+## Usage Notes
+- If the parameter is NULL, returns NULL.
+- If the parameter contains escape symbol (`\`) + non-escape character, the
escape symbol will be removed, see examples 4 and 5.
-## Return Values
-Return a json_value. Special cases are as follows:
-* If the passed parameter is NULL, return NULL.
+## Examples
+1. Double quotes are escaped
+ ```sql
+ select json_quote('I am a "string" that contains double quotes.');
+ ```
+ ```
+ +------------------------------------------------------------+
+ | json_quote('I am a "string" that contains double quotes.') |
+ +------------------------------------------------------------+
+ | "I am a \"string\" that contains double quotes." |
+ +------------------------------------------------------------+
+ ```
+2. Escaping special characters
+ ```sql
+ select json_quote("\\ \b \n \r \t");
+ ```
+ ```
+ +------------------------------+
+ | json_quote("\\ \b \n \r \t") |
+ +------------------------------+
+ | "\\ \b \n \r \t" |
+ +------------------------------+
+ ```
-### Examples
-```sql
-SELECT json_quote('null'), json_quote('"null"');
-```
-```text
-+--------------------+----------------------+
-| json_quote('null') | json_quote('"null"') |
-+--------------------+----------------------+
-| "null" | "\"null\"" |
-+--------------------+----------------------+
-```
-```sql
-SELECT json_quote('[1, 2, 3]');
-```
-```text
-+-------------------------+
-| json_quote('[1, 2, 3]') |
-+-------------------------+
-| "[1, 2, 3]" |
-+-------------------------+
-```
-```sql
-SELECT json_quote(null);
-```
-```text
-+------------------+
-| json_quote(null) |
-+------------------+
-| NULL |
-+------------------+
-```
-```sql
-select json_quote("\n\b\r\t");
-```
-```text
-+------------------------+
-| json_quote('\n\b\r\t') |
-+------------------------+
-| "\n\b\r\t" |
-+------------------------+
-```
+3. Control character escaping
+ ```sql
+ select json_quote("\0");
+ ```
+ ```
+ +------------------+
+ | json_quote("\0") |
+ +------------------+
+ | "\u0000" |
+ +------------------+
+ ```
+
+4. Escape symbol + non-escape character case
+ ```sql
+ select json_quote("\a");
+ ```
+ ```
+ +------------------+
+ | json_quote("\a") |
+ +------------------+
+ | "a" |
+ +------------------+
+ ```
+5. Non-zero unprintable characters
+ ```sql
+ select json_quote("\1");
+ ```
+ ```
+ +------------------+
+ | json_quote("\1") |
+ +------------------+
+ | "1" |
+ +------------------+
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-unquote.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-unquote.md
index 0eb9e181097..493d6e4aaf1 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-unquote.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-unquote.md
@@ -6,108 +6,96 @@
---
## Description
-This function unquotes a JSON value and returns the result as a utf8mb4
string. If the argument is NULL, it will return NULL.
+This function removes quotes from JSON values and returns the result as a
string. If the parameter is NULL, it returns NULL.
-## Syntax
-```sql
-JSON_UNQUOTE (<a>)
-```
-## Parameters
-| Parameters | Description |
-|------|-------------------------------------------------------|
-| `<a>` | The element to be unquoted. |
-
-## Return Values
-
-Returns a utf8mb4 string. Special cases are as follows:
-* If the passed parameter is NULL, return NULL.
-* If the passed parameter is not a value with double quotes, the value itself
will be returned.
-* If the passed parameter is not a string, it will be automatically converted
to a string and then the value itself will be returned.
-
-Escape sequences within a string as shown in the following table will be
recognized. Backslashes will be ignored for all other escape sequences.
-
-| Escape Sequence | Character Represented by Sequence |
-|-----------------|------------------------------------|
-| \" | A double quote (") character |
-| \b | A backspace character |
-| \f | A formfeed character |
-| \n | A newline (linefeed) character |
-| \r | A carriage return character |
-| \t | A tab character |
-| \\ | A backslash (\) character |
-| \uxxxx | UTF-8 bytes for Unicode value XXXX |
+Special characters include:
+* Quote (`"`)
+* Backslash (`\`)
+* Backspace (`\b`)
+* Newline (`\n`)
+* Carriage return (`\r`)
+* Horizontal tab (`\t`)
+Control characters include:
+* `CHAR(0)` is escaped as `\u0000`
-### Examples
+## Syntax
```sql
-SELECT json_unquote('"doris"');
+JSON_UNQUOTE (<str>)
```
-```text
-+-------------------------+
-| json_unquote('"doris"') |
-+-------------------------+
-| doris |
-+-------------------------+
-```
-```sql
-SELECT json_unquote('[1, 2, 3]');
-```
-```text
-+---------------------------+
-| json_unquote('[1, 2, 3]') |
-+---------------------------+
-| [1, 2, 3] |
-+---------------------------+
-```
-```sql
-SELECT json_unquote(null);
-```
-```text
-+--------------------+
-| json_unquote(NULL) |
-+--------------------+
-| NULL |
-+--------------------+
-```
-```sql
-SELECT json_unquote('"\\ttest"');
-```
-```text
-+--------------------------+
-| json_unquote('"\ttest"') |
-+--------------------------+
-| test |
-+--------------------------+
-```
-```sql
-select json_unquote('"doris');
-```
-```text
-+------------------------+
-| json_unquote('"doris') |
-+------------------------+
-| "doris |
-+------------------------+
-```
-```sql
-select json_unquote('doris');
-```
-```text
-+-----------------------+
-| json_unquote('doris') |
-+-----------------------+
-| doris |
-+-----------------------+
-```
-```sql
-select json_unquote(1);
-```
-```text
-+-----------------------------------------+
-| json_unquote(cast(1 as VARCHAR(65533))) |
-+-----------------------------------------+
-| 1 |
-+-----------------------------------------+
-```
+## Parameters
+- `<str>` The string from which quotes are to be removed.
+
+## Return Value
+Returns a string. Special cases are as follows:
+* If the input parameter is NULL, returns NULL.
+* If the input parameter is not a value enclosed in double quotes, it returns
the value itself.
+* If the input parameter is not a string, it will be automatically converted
to a string and then return the value itself.
+
+## Examples
+1. Escape characters in strings are removed
+ ```sql
+ select json_unquote('"I am a \\"string\\" that contains double quotes."');
+ ```
+ ```
+ +--------------------------------------------------------------------+
+ | json_unquote('"I am a \\"string\\" that contains double quotes."') |
+ +--------------------------------------------------------------------+
+ | I am a "string" that contains double quotes. |
+ +--------------------------------------------------------------------+
+ ```
+2. Escaping special characters
+ ```sql
+ select json_unquote('"\\\\ \\b \\n \\r \\t"');
+ ```
+ ```
+ +----------------------------------------+
+ | json_unquote('"\\\\ \\b \\n \\r \\t"') |
+ +----------------------------------------+
+ | \
+ |
+ +----------------------------------------+
+ ```
+ > Because escape characters are removed, some whitespace characters
(newline, backspace, tab, etc.) will be printed
+3. Control character escaping
+ ```sql
+ select json_unquote('"\\u0000"');
+ ```
+ ```
+ +---------------------------+
+ | json_unquote('"\\u0000"') |
+ +---------------------------+
+ | |
+ +---------------------------+
+ ```
+4. Invalid JSON string
+ ```sql
+ select json_unquote('"I am a "string" that contains double quotes."');
+ ```
+ ```
+ ERROR 1105 (HY000): errCode = 2, detailMessage = [RUNTIME_ERROR]Invalid
JSON text in argument 1 to function json_unquote: "I am a "string" that
contains double quotes."
+ ```
+5. Case where it starts with quotes but doesn't end with quotes
+ ```sql
+ select json_unquote('"I am a "string" that contains double quotes.');
+ ```
+ ```
+ +---------------------------------------------------------------+
+ | json_unquote('"I am a "string" that contains double quotes.') |
+ +---------------------------------------------------------------+
+ | "I am a "string" that contains double quotes. |
+ +---------------------------------------------------------------+
+ ```
+6. Case where it ends with quotes
+ ```sql
+ select json_unquote('I am a "string" that contains double quotes."');
+ ```
+ ```
+ +---------------------------------------------------------------+
+ | json_unquote('I am a "string" that contains double quotes."') |
+ +---------------------------------------------------------------+
+ | I am a "string" that contains double quotes." |
+ +---------------------------------------------------------------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-contains.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-contains.md
index 30d0f105731..4e7fefecc19 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-contains.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-contains.md
@@ -11,96 +11,85 @@
## 语法
-`JSON_CONTAINS(<json_str>, <candidate> [, <json_path>])`
-
-
-## 必选参数
-
-| 参数 | 描述 |
-|------|------|
-| `<json_str>` | 需要检查的 JSON 字符串。 |
-| `<candidate>` | 用于检查是否包含的 JSON 元素。 |
-
-## 可选参数
-
-| 参数 | 描述 |
-|------|------|
-| `<json_path>` | 可选的 JSON 路径,指定检查的 JSON 子文档。如果不提供,默认为根文档。 |
-
-## 返回值
-- 如果 json_elem 存在于 json_doc 中,则返回 1。
-- 如果 json_elem 不存在于 json_doc 中,则返回 0。
-- 如果任何参数无效或 JSON 文档格式不正确,则返回 NULL。
-
-## 示例
-
-```sql
-
-SET @j = '{"a": 1, "b": 2, "c": {"d": 4}}';
-SET @j2 = '1';
-SELECT JSON_CONTAINS(@j, @j2, '$.a');
-
-```
-
```sql
-
-+-------------------------------+
-| JSON_CONTAINS(@j, @j2, '$.a') |
-+-------------------------------+
-| 1 |
-+-------------------------------+
-
+JSON_CONTAINS(<json_object>, <candidate>[, <json_path>])
```
-```sql
-SELECT JSON_CONTAINS(@j, @j2, '$.b');
-+-------------------------------+
-| JSON_CONTAINS(@j, @j2, '$.b') |
-+-------------------------------+
-| 0 |
-+-------------------------------+
-
-```
-```sql
-
-SET @j2 = '{"d": 4}';
-SELECT JSON_CONTAINS(@j, @j2, '$.a');
-
-```
-
-```sql
-
-+-------------------------------+
-| JSON_CONTAINS(@j, @j2, '$.a') |
-+-------------------------------+
-| 0 |
-+-------------------------------+
-```
-
-```sql
-
-SELECT JSON_CONTAINS(@j, @j2, '$.c');
-
-```
-
-```sql
-
-+-------------------------------+
-| JSON_CONTAINS(@j, @j2, '$.c') |
-+-------------------------------+
-| 1 |
-+-------------------------------+
-
-```
-
-```sql
-
-SELECT json_contains('[1, 2, {"x": 3}]', '1');
-+----------------------------------------+
-| json_contains('[1, 2, {"x": 3}]', '1') |
-+----------------------------------------+
-| 1 |
-+----------------------------------------+
-
-```
+## 参数
+### 必选参数
+- `<json_object>` JSON 类型,检查其中是否存在 `<candidate>`。
+- `<candidate>` JSON 类型,要判断的候选值。
+### 可选参数
+- `<json_path>` String 类型,搜索起始路径,如果不提供默认从 root 开始。
+## 返回值
+- Null 如果三个参数任意一个为 NULL,返回 NULL
+- True 如果`<json_object>` 存在 `<candidate>`,返回 True。
+- False 如果`<json_object>` 不存在 `<candidate>`,返回 False。
+- 如果 `<json_object>` 或 `<candidate>` 不是 JSON 类型,报错。
+
+## 示例
+1. 示例 1
+ ```sql
+ SET @j = '{"a": 1, "b": 2, "c": {"d": 4}}';
+ SET @j2 = '1';
+ SELECT JSON_CONTAINS(@j, @j2, '$.a');
+ ```
+ ```text
+ +-------------------------------+
+ | JSON_CONTAINS(@j, @j2, '$.a') |
+ +-------------------------------+
+ | 1 |
+ +-------------------------------+
+ ```
+ ```sql
+ SELECT JSON_CONTAINS(@j, @j2, '$.b');
+ ```
+ ```text
+ +-------------------------------+
+ | JSON_CONTAINS(@j, @j2, '$.b') |
+ +-------------------------------+
+ | 0 |
+ +-------------------------------+
+ ```
+ ```sql
+ SELECT JSON_CONTAINS(@j, '{"a": 1}');
+ ```
+ ```text
+ +-------------------------------+
+ | JSON_CONTAINS(@j, '{"a": 1}') |
+ +-------------------------------+
+ | 1 |
+ +-------------------------------+
+ ```
+2. NULL 参数
+ ```sql
+ SELECT JSON_CONTAINS(NULL, '{"a": 1}');
+ ```
+ ```text
+ +---------------------------------+
+ | JSON_CONTAINS(NULL, '{"a": 1}') |
+ +---------------------------------+
+ | NULL |
+ +---------------------------------+
+ ```
+ ```sql
+ SELECT JSON_CONTAINS('{"a": 1}', NULL);
+ ```
+ ```text
+ +---------------------------------+
+ | JSON_CONTAINS('{"a": 1}', NULL) |
+ +---------------------------------+
+ | NULL |
+ +---------------------------------+
+ ```
+ ```sql
+ SELECT JSON_CONTAINS('{"a": 1}', '{"a": 1}', NULL);
+ ```
+ ```text
+ +---------------------------------------------+
+ | JSON_CONTAINS('{"a": 1}', '{"a": 1}', NULL) |
+ +---------------------------------------------+
+ | NULL |
+ +---------------------------------------------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-exists-path.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-exists-path.md
index e880ce2c600..13bb6153583 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-exists-path.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-exists-path.md
@@ -7,57 +7,64 @@
## 描述
-用来判断 `json_path` 指定的字段在 JSON 数据中是否存在,如果存在返回 TRUE,不存在返回 FALSE
+用来判断 `<path>` 指定的字段在 JSON 数据中是否存在,如果存在返回 TRUE,不存在返回 FALSE
## 语法
```sql
-JSON_EXISTS_PATH (<json_str>, <path>)
+JSON_EXISTS_PATH (<json_object>, <path>)
```
-## 别名
-
-* JSONB_EXISTS_PATH
-
## 参数
-| 参数 | 描述 |
-|--------------|--------------------------------------------------------|
-| `<json_str>` | 要包含在 JSON 数组中的元素。可以是任意类型的值,包括`NULL`。如果没有指定元素,则返回一个空数组。
-| `<path>` | 要插入的 JSON 路径。如果是 `NULL` ,则返回 NULL |
+- `<json_object>` JSON 类型,在其中判断 `<path>` 指定的路径是否存在。
+- `<path>` String 类型,指定路径。
## 返回值
-如果存在返回 TRUE,不存在返回 FALSE
-
-## 举例
+- BOOL 类型,如果存在返回 TRUE,不存在返回 FALSE
+- NULL 如果 `<json_object>` 和 `<path>` 任意一个为 NULL,返回 NULL。
-```sql
-SELECT JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.name');
-```
-```text
-+---------------------------------------------------------------------------+
-| jsonb_exists_path(cast('{"id": 123, "name": "doris"}' as JSON), '$.name') |
-+---------------------------------------------------------------------------+
-| 1 |
-+---------------------------------------------------------------------------+
-```
-```sql
-SELECT JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.age');
-```
-```text
-+--------------------------------------------------------------------------+
-| jsonb_exists_path(cast('{"id": 123, "name": "doris"}' as JSON), '$.age') |
-+--------------------------------------------------------------------------+
-| 0 |
-+--------------------------------------------------------------------------+
-```
-```sql
-SELECT JSONB_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.age');
-```
-```text
-+--------------------------------------------------------------------------+
-| jsonb_exists_path(cast('{"id": 123, "name": "doris"}' as JSON), '$.age') |
-+--------------------------------------------------------------------------+
-| 0 |
-+--------------------------------------------------------------------------+
-```
+## 示例
+1. 示例 1
+ ```sql
+ SELECT JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.name');
+ ```
+ ```text
+ +------------------------------------------------------------+
+ | JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.name') |
+ +------------------------------------------------------------+
+ | 1 |
+ +------------------------------------------------------------+
+ ```
+2. 示例 2
+ ```sql
+ SELECT JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.age');
+ ```
+ ```text
+ +-----------------------------------------------------------+
+ | JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', '$.age') |
+ +-----------------------------------------------------------+
+ | 0 |
+ +-----------------------------------------------------------+
+ ```
+3. NULL 参数
+ ```sql
+ SELECT JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', NULL);
+ ```
+ ```text
+ +--------------------------------------------------------+
+ | JSON_EXISTS_PATH('{"id": 123, "name": "doris"}', NULL) |
+ +--------------------------------------------------------+
+ | NULL |
+ +--------------------------------------------------------+
+ ```
+ ```sql
+ SELECT JSON_EXISTS_PATH(NULL, '$.age');
+ ```
+ ```text
+ +---------------------------------+
+ | JSON_EXISTS_PATH(NULL, '$.age') |
+ +---------------------------------+
+ | NULL |
+ +---------------------------------+
+ ```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-bigint.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-bigint.md
index 969ef7e7dfa..eeed63dd29d 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-bigint.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-bigint.md
@@ -34,6 +34,7 @@ JSON_EXTRACT_BIGINT(<json_object>, <json_path>)
```sql
SELECT json_extract_int('{"id": 122222222222223, "name": "doris"}',
'$.id');
```
+ ```text
+-------------------------------------------------------------------------+
| json_extract_bigint('{"id": 122222222222223, "name": "doris"}', '$.id') |
+-------------------------------------------------------------------------+
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-bool.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-bool.md
index 0776d663e33..d70dd2f331c 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-bool.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-bool.md
@@ -40,11 +40,12 @@ JSON_EXTRACT_BOOL(<json_object>, <json_path>)
+------------------------------------------------------------+
| 1 |
+------------------------------------------------------------+
- ```
+ ```
2. 路径不存在的情况
```sql
SELECT json_extract_bool('{"id": true, "name": "doris"}', '$.id2');
```
+ ```text
+-------------------------------------------------------------+
| json_extract_bool('{"id": true, "name": "doris"}', '$.id2') |
+-------------------------------------------------------------+
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-largeint.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-largeint.md
index bbbafe0ecfb..60c8b9c5072 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-largeint.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract-largeint.md
@@ -34,6 +34,7 @@ JSON_EXTRACT_LARGEINT(<json_object>, <json_path>)
```sql
SELECT json_extract_largeint('{"id": 11529215046068469760, "name":
"doris"}', '$.id');
```
+ ```text
+--------------------------------------------------------------------------------+
| json_extract_largeint('{"id": 11529215046068469760, "name": "doris"}',
'$.id') |
+--------------------------------------------------------------------------------+
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract.md
index b60b0f29527..a377961e52a 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-extract.md
@@ -39,17 +39,17 @@ JSON_EXTRACT (<json_object>, <path>[, <path2>, ...])
## 示例
1. 一般参数
- ```sql
- SELECT JSON_EXTRACT('{"k1":"v31","k2":300}', '$.k1');
- ```
- ```
- +-----------------------------------------------+
- | JSON_EXTRACT('{"k1":"v31","k2":300}', '$.k1') |
- +-----------------------------------------------+
- | "v31" |
- +-----------------------------------------------+
- ```
-> 注意:返回的结果是`"v31"` 不是 `v31`。
+ ```sql
+ SELECT JSON_EXTRACT('{"k1":"v31","k2":300}', '$.k1');
+ ```
+ ```
+ +-----------------------------------------------+
+ | JSON_EXTRACT('{"k1":"v31","k2":300}', '$.k1') |
+ +-----------------------------------------------+
+ | "v31" |
+ +-----------------------------------------------+
+ ```
+ > 注意:返回的结果是`"v31"` 不是 `v31`。
2. NULL 参数
```sql
select JSON_EXTRACT(null, '$.k1');
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-insert.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-insert.md
index b97c152fde8..7cc9da91f49 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-insert.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-insert.md
@@ -19,7 +19,7 @@ JSON_INSERT (<json_object>, <path>, <value>[, <path>,
<value>, ...])
- `<value>` JSON 类型或其他 [`TO_JSON`](./to-json.md) 支持的类型,要插入的值。
## 返回值
-- Nullable(JSON) 返回被修改后的 JSON 对象
+- `Nullable(JSON)` 返回被修改后的 JSON 对象
## 使用说明
1. 需要注意的是,路径值对按从左到右的顺序进行评估。
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-keys.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-keys.md
index d6af36050a2..97de96dc170 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-keys.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-keys.md
@@ -6,118 +6,114 @@
---
## 描述
-用于从 JSON 对象的顶级值中返回键。这些键作为数组返回,或者如果给定了路径参数,则返回所选路径的顶级键。您需要将 JSON
文档作为函数的参数提供。您还可以(可选地)提供第二个参数,以指定 JSON 文档中“顶级”路径从何处开始。
-其中,json_doc 是 JSON 文档,path 是一个可选参数,用于确定 JSON 文档中“顶级”路径从何处开始。
+以数组形式返回 JSON 对象的所有键(key)。 默认情况返回 root 对象的键,也可以通过参数控制返回具体某个路径对应的对象的键。
## 语法
-`JSON_KEYS(<str> [, <path>])`
-
-## 别名
-
-- JSONB_KEYS
-
-## 必选参数
-
-| 参数 | 描述 |
-|------|------|
-| `<str>` | 需要提取键的 JSON 字符串。 |
+```sql
+JSON_KEYS(<json_object>[, <path>])
+```
+## 参数
+### 必选参数
+- `<json_object>` JSON 类型,需要提取键的 JSON 对象。
-## 可选参数
-| 参数 | 描述 |
-|------|------|
-| `<path>` | 可选的 JSON 路径,指定检查的 JSON 子文档。如果不提供,默认为根文档。 |
+### 可选参数
+- `<path>` String 类型,可选的 JSON 路径,指定检查的 JSON 子文档。如果不提供,默认为根文档。
## 返回值
-
-- 返回 JSON 文档的键名列表(一个 JSON 数组)。
-- 如果 str 不是一个有效的 JSON 对象,返回 NULL。
-- 如果 JSON 对象没有键,返回一个空数组。
+- `Array<String>` 返回一个字符串的数组,数组成员就是 JSON 对象的所有键。
## 注意事项
-
-- 如果所选对象为空,则结果数组为空。如果顶级值包含嵌套的子对象,返回值不包括这些子对象的键。
+- `<json_object>` 或者 `<path>` 为 NULL 时返回 NULL。
+- 如果不是 JSON 对象(比如是 JSON 数组),返回 NULL。
+- 如果 `<path>` 指向的对象不存在,返回 NULL。
## 示例
-
-```sql
-
-SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}');
-
-```
-
-```sql
-
-+-----------------------------------------------------+
-| json_keys(cast('{"a": 1, "b": {"c": 30}}' as JSON)) |
-+-----------------------------------------------------+
-| ["a", "b"] |
-+-----------------------------------------------------+
-
-```
-
-```sql
-
-SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}', '$.b');
-
-```
-
-```sql
-+------------------------------------------------------------+
-| json_keys(cast('{"a": 1, "b": {"c": 30}}' as JSON), '$.b') |
-+------------------------------------------------------------+
-| ["c"] |
-+------------------------------------------------------------+
-```
-
-```sql
-
-SELECT JSON_KEYS('{}');
-
-```
-
-```sql
-
-+-------------------------------+
-| json_keys(cast('{}' as JSON)) |
-+-------------------------------+
-| [] |
-+-------------------------------+
-
-```
-
-```sql
-
-SELECT JSON_KEYS('[1,2]');
-
-```
-
-```sql
-
-+----------------------------------+
-| json_keys(cast('[1,2]' as JSON)) |
-+----------------------------------+
-| NULL |
-+----------------------------------+
-
-```
-
-```sql
-
- SELECT JSON_KEYS('[]');
-
- ```
-
- ```sql
-
-+-------------------------------+
-| json_keys(cast('[]' as JSON)) |
-+-------------------------------+
-| NULL |
-+-------------------------------+
-
-```
-
-
+1. 示例 1
+ ```sql
+ SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}');
+ ```
+ ```text
+ +---------------------------------------+
+ | JSON_KEYS('{"a": 1, "b": {"c": 30}}') |
+ +---------------------------------------+
+ | ["a", "b"] |
+ +---------------------------------------+
+ ```
+ ```sql
+ SELECT JSON_KEYS('{}');
+ ```
+ ```text
+ +-----------------+
+ | JSON_KEYS('{}') |
+ +-----------------+
+ | [] |
+ +-----------------+
+ ```
+
+2. 指定 path
+ ```sql
+ SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}', '$.b');
+ ```
+ ```text
+ +----------------------------------------------+
+ | JSON_KEYS('{"a": 1, "b": {"c": 30}}', '$.b') |
+ +----------------------------------------------+
+ | ["c"] |
+ +----------------------------------------------+
+ ```
+3. NULL 参数
+ ```sql
+ SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}', NULL);
+ ```
+ ```text
+ +---------------------------------------------+
+ | JSON_KEYS('{"a": 1, "b": {"c": 30}}', NULL) |
+ +---------------------------------------------+
+ | NULL |
+ +---------------------------------------------+
+ ```
+ ```sql
+ SELECT JSON_KEYS(NULL);
+ ```
+ ```text
+ +-----------------+
+ | JSON_KEYS(NULL) |
+ +-----------------+
+ | NULL |
+ +-----------------+
+ ```
+4. 不是 JSON 对象
+ ```sql
+ SELECT JSON_KEYS('[1,2]');
+ ```
+ ```text
+ +--------------------+
+ | JSON_KEYS('[1,2]') |
+ +--------------------+
+ | NULL |
+ +--------------------+
+ ```
+ ```sql
+ SELECT JSON_KEYS('{"k": [1, 2, 3]}', '$.k');
+ ```
+ ```text
+ +--------------------------------------+
+ | JSON_KEYS('{"k": [1, 2, 3]}', '$.k') |
+ +--------------------------------------+
+ | NULL |
+ +--------------------------------------+
+ ```
+5. path 指定的对象不存在
+ ```sql
+ SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}', '$.c');
+ ```
+ ```text
+ +----------------------------------------------+
+ | JSON_KEYS('{"a": 1, "b": {"c": 30}}', '$.c') |
+ +----------------------------------------------+
+ | NULL |
+ +----------------------------------------------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-length.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-length.md
index bfb900bf988..27c2ec6c916 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-length.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-length.md
@@ -6,74 +6,115 @@
---
## 描述
-`JSON_LENGTH` 函数用于返回给定 JSON 文档的长度或元素个数。如果 JSON 文档是一个数组,则返回数组中元素的个数;如果 JSON
文档是一个对象,则返回对象中键值对的个数。如果 JSON 文档为空或无效,返回 `NULL`。
+`JSON_LENGTH` 函数用于返回给定 JSON 文档的长度或元素个数。如果 JSON 文档是一个数组,则返回数组中元素的个数;如果 JSON
文档是一个对象,则返回对象中键值对的个数。如果 JSON 文档为 NULL 或无效,返回 `NULL`。
## 语法
```sql
-JSON_LENGTH(<json_str> [ , <json_path>])
+JSON_LENGTH(<json_object> [, <path>])
```
+## 参数
+### 必选参数
+- `<json_object>` JSON 类型,要返回其长度的 JSON 文档。
-## 必选参数
-
-| 参数 | 描述 |
-|------|------|
-| `<json_str>` | 需要检查长度的 JSON 字符串。 |
-
-
-## 可选参数
-
-| 参数 | 描述 |
-|------|------|
-| `<json_path>` | 如果指定 path,该 JSON_LENGTH() 函数返回与 JSON 文档中的路径匹配的数据的长度,否则返回
JSON 文档的长度 |
+### 可选参数
+- `<path>` String 类型,用于返回文档中某个对象的长度。
## 注意事项
该函数根据以下规则计算 JSON 文档的长度:
- 标量的长度为 1。例如:'1', '"x"', 'true', 'false', 'null' 的长度均为 1。
- 数组的长度是数组元素的数量。例如:'[1, 2]' 的长度为 2。
-- 对象的长度是对象成员的数量。例如:'{"x": 1}' 的长度为 1
+- 对象的长度是对象成员的数量。例如:'{"x": 1, "y": [1, 2, 3]}' 的长度为 2。
## 返回值
- 对于 JSON 数组,返回数组中元素的个数。
- 对于 JSON 对象,返回对象中键值对的个数。
+- 对于 JSON 标量类型(如字符串、数字、布尔值、null 等),返回 1。
- 对于无效的 JSON 字符串,返回 NULL。
-- 对于其他类型(如字符串、数字、布尔值、null 等),返回 NULL。
## 示例
-
-```sql
-SELECT json_length('{"k1":"v31","k2":300}');
-```
-```sql
-+--------------------------------------+
-| json_length('{"k1":"v31","k2":300}') |
-+--------------------------------------+
-| 2 |
-+--------------------------------------+
-```
-
-```sql
-SELECT json_length('"abc"');
-```
-
-```sql
-+----------------------+
-| json_length('"abc"') |
-+----------------------+
-| 1 |
-+----------------------+
-```
-
-```sql
-SELECT json_length('{"x": 1, "y": [1, 2]}', '$.y');
-```
-
-```sql
-+---------------------------------------------+
-| json_length('{"x": 1, "y": [1, 2]}', '$.y') |
-+---------------------------------------------+
-| 2 |
-+---------------------------------------------+
-
-```
+1. 示例 1
+ ```sql
+ SELECT json_length('{"k1":"v31","k2":300}');
+ ```
+ ```text
+ +--------------------------------------+
+ | json_length('{"k1":"v31","k2":300}') |
+ +--------------------------------------+
+ | 2 |
+ +--------------------------------------+
+ ```
+ ```sql
+ SELECT json_length('[1, 2, 3, 4, 5, 6]');
+ ```
+ ```text
+ +-----------------------------------+
+ | json_length('[1, 2, 3, 4, 5, 6]') |
+ +-----------------------------------+
+ | 6 |
+ +-----------------------------------+
+ ```
+2. 标量类型的长度
+ ```sql
+ SELECT json_length('"abc"');
+ ```
+ ```text
+ +----------------------+
+ | json_length('"abc"') |
+ +----------------------+
+ | 1 |
+ +----------------------+
+ ```
+ ```sql
+ SELECT json_length('123');
+ ```
+ ```text
+ +--------------------+
+ | json_length('123') |
+ +--------------------+
+ | 1 |
+ +--------------------+
+ ```
+ ```sql
+ SELECT json_length('{"k": null}');
+ ```
+ ```text
+ +----------------------------+
+ | json_length('{"k": null}') |
+ +----------------------------+
+ | 1 |
+ +----------------------------+
+ ```
+3. 指定 path
+ ```sql
+ SELECT json_length('{"x": 1, "y": [1, 2]}', '$.y');
+ ```
+ ```text
+ +---------------------------------------------+
+ | json_length('{"x": 1, "y": [1, 2]}', '$.y') |
+ +---------------------------------------------+
+ | 2 |
+ +---------------------------------------------+
+ ```
+4. NULL 参数
+ ```sql
+ SELECT json_length('{"x": 1, "y": [1, 2]}', NULL);
+ ```
+ ```text
+ +--------------------------------------------+
+ | json_length('{"x": 1, "y": [1, 2]}', NULL) |
+ +--------------------------------------------+
+ | NULL |
+ +--------------------------------------------+
+ ```
+ ```sql
+ SELECT json_length(NULL, '$.y');
+ ```
+ ```text
+ +--------------------------+
+ | json_length(NULL, '$.y') |
+ +--------------------------+
+ | NULL |
+ +--------------------------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-invalid.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-invalid.md
deleted file mode 100644
index b74ca281777..00000000000
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-invalid.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-{
- "title": "JSON_PARSE_ERROR_TO_INVALID",
- "language": "zh-CN"
-}
----
-
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-null.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-null.md
index c945a1a2485..e8add807398 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-null.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-null.md
@@ -5,3 +5,5 @@
}
---
+## 描述
+函数 [`JSON_PARSE`](./json-parse.md) 的变种。
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-value.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-value.md
index 0d57e931898..8dcec53a98b 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-value.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-value.md
@@ -5,3 +5,5 @@
}
---
+## 描述
+函数 [`JSON_PARSE`](./json-parse.md) 的变种。
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-invalid.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-invalid.md
deleted file mode 100644
index 259b64d0350..00000000000
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-invalid.md
+++ /dev/null
@@ -1,47 +0,0 @@
----
-{
- "title": "JSON_PARSE_NOTNULL_ERROR_TO_INVALID",
- "language": "zh-CN"
-}
----
-
-## 描述
-
-用于解析 JSON 字符串。如果 JSON 字符串格式无效或发生解析错误,函数会返回一个无效的 JSON 对象(通常是
`{}`)。该函数的主要作用是确保在出现 JSON 格式错误时,返回一个安全的默认值,避免由于解析错误导致的查询失败。
-
-
-## 别名
-
-- JSONB_PARSE_NOTNULL_ERROR_TO_INVALID
-
-## 语法
-
-```sql
-JSON_PARSE_NOTNULL_ERROR_TO_INVALID( <str> )
-```
-## 必选参数
-
-| 参数 | 描述 |
-|------|------|
-| `<str>` | 需要解析的 JSON 字符串。该参数应该是一个有效的字符串类型,包含 JSON 格式的数据。如果 JSON
格式无效,函数会返回一个无效的 JSON 对象。 |
-
-
-## 返回值
-
-返回一个无效的 JSON 对象(通常是 `{}`)
-
-
-## 示例
-
-```sql
-SELECT JSON_PARSE_NOTNULL_ERROR_TO_INVALID('{"name": "Alice", "age": 30}') AS
parsed_json;
-
-```
-```sql
-+---------------------------+
-| parsed_json |
-+---------------------------+
-| {"name":"Alice","age":30} |
-+---------------------------+
-
-```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-value.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-value.md
deleted file mode 100644
index 22c5beaf268..00000000000
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-value.md
+++ /dev/null
@@ -1,48 +0,0 @@
----
-{
- "title": "JSON_PARSE_NOTNULL_ERROR_TO_VALUE",
- "language": "zh-CN"
-}
----
-
-## 描述
-
-函数用于解析 JSON 字符串。如果 JSON 字符串格式无效或发生解析错误,函数会返回用户指定的默认值,而不是返回无效的 JSON
对象。该函数的主要作用是提供一个默认值,用于替代解析错误时的无效结果,确保查询返回合理的值。
-
-## 语法
-
-```sql
-JSON_PARSE_NOTNULL_ERROR_TO_VALUE(< str >, <default_value>)
-```
-
-## 别名
-
-- JSONB_PARSE_NOTNULL_ERROR_TO_VALUE
-
-## 必选参数
-
-| 参数 | 描述 |
-|------|------|
-| `<str>` | 需要解析的 JSON 字符串。该参数应为一个有效的 JSON 字符串。如果 JSON 格式无效,函数会返回
default_value。 |
-| `<default_value>` | 解析错误时返回的默认值。该参数可以是任意类型,用于替代无效的 JSON 格式数据。 |
-
-
-## 返回值
-
-返回一个 JSON 对象。如果输入的 JSON 字符串有效,返回解析后的 JSON 对象;如果无效,返回用户指定的 default_value。
-
-
-## 示例
-
-```sql
-SELECT JSON_PARSE_NOTNULL_ERROR_TO_VALUE('{"name": "Alice", "age": 30}',
'{"name": "Unknown", "age": 0}') AS parsed_json;
-
-```
-```sql
-+-------------------------------------------+
-| parsed_json |
-+-------------------------------------------+
-| {"name":"Alice","age":30} |
-+-------------------------------------------+
-
-```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull.md
deleted file mode 100644
index 1e3e9346a4c..00000000000
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-{
- "title": "JSON_PARSE_NOTNULL",
- "language": "zh-CN"
-}
----
-
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-invalid.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-invalid.md
deleted file mode 100644
index 84e479a3a07..00000000000
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-invalid.md
+++ /dev/null
@@ -1,71 +0,0 @@
----
-{
- "title": "JSON_PARSE_NULLABLE_ERROR_TO_INVALID",
- "language": "zh-CN"
-}
----
-
-## 描述
-
-`JSON_PARSE_NULLABLE_ERROR_TO_INVALID` 函数用于解析一个 JSON 字符串为有效的 JSON 对象。如果输入的
JSON 字符串无效,它将返回一个 "无效的 JSON" 标记(通常为 `INVALID_JSON`),而不会抛出错误。如果输入为 `NULL`,也会返回
`INVALID_JSON`。
-
-## 语法
-
-```sql
-JSON_PARSE_NULLABLE_ERROR_TO_INVALID( <str> )
-```
-## 别名
-
-- JSONB_PARSE_NULLABLE_ERROR_TO_INVALID
-
-## 必选参数
-
-| 参数 | 描述 |
-|------|------|
-| `<str>` | 需要解析的 JSON 格式的输入字符串。 |
-
-## 返回值
-如果输入字符串是有效的 JSON,返回对应的 JSON 对象。
-如果输入字符串无效或为 NULL,返回 INVALID_JSON 标记。
-
-## 举例
-1. 有效的 JSON 字符串:
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_INVALID('{"name": "John", "age": 30}');
-
-```
-
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_INVALID('{"name": "John", "age": 30}') |
-+---------------------------------------------------------------+
-| {"name": "John", "age": 30} |
-+---------------------------------------------------------------+
-
-```
-2. 无效的 JSON 字符串:
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_INVALID('{"name": "John", "age": }');
-
-```
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_INVALID('{"name": "John", "age": }') |
-+---------------------------------------------------------------+
-| INVALID_JSON |
-+---------------------------------------------------------------+
-
-```
-3. 输入为 NULL:
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_INVALID(NULL);
-
-```
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_INVALID(NULL) |
-+---------------------------------------------------------------+
-| INVALID_JSON |
-+---------------------------------------------------------------+
-
-```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-null.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-null.md
deleted file mode 100644
index 88db5b06be2..00000000000
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-null.md
+++ /dev/null
@@ -1,78 +0,0 @@
----
-{
- "title": "JSON_PARSE_NULLABLE_ERROR_TO_NULL",
- "language": "zh-CN"
-}
----
-
-## 描述
-
-`JSON_PARSE_NULLABLE_ERROR_TO_NULL` 函数用于解析一个 JSON 字符串为有效的 JSON 对象。如果输入的 JSON
字符串无效,它将返回 `NULL`,而不会抛出错误。如果输入为 `NULL`,则直接返回 `NULL`。
-
-## 语法
-
-```sql
-JSON_PARSE_NULLABLE_ERROR_TO_NULL( <str> )
-```
-## 别名
-
-- JSONB_PARSE_NULLABLE_ERROR_TO_NULL
-
-## 必选参数
-
-| 参数 | 描述 |
-|------|------|
-| `<str>` | 需要解析的 JSON 格式的输入字符串。 |
-
-## 返回值
-
-如果输入字符串是有效的 JSON,返回对应的 JSON 对象。
-如果输入字符串无效或为 NULL,返回 NULL。
-
-## 举例
-
-1. 有效的 JSON 字符串:
-
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_NULL('{"name": "John", "age": 30}');
-
-```
-
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_NULL('{"name": "John", "age": 30}') |
-+---------------------------------------------------------------+
-| {"name": "John", "age": 30} |
-+---------------------------------------------------------------+
-
-```
-2. 无效的 JSON 字符串:
-
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_NULL('{"name": "John", "age": }');
-
-```
-
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_NULL('{"name": "John", "age": }') |
-+---------------------------------------------------------------+
-| NULL |
-+---------------------------------------------------------------+
-
-```
-3. 输入为 NULL:
-
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_NULL(NULL);
-
-```
-
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_NULL(NULL) |
-+---------------------------------------------------------------+
-| NULL |
-+---------------------------------------------------------------+
-
-```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-value.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-value.md
deleted file mode 100644
index ea7a51dbf75..00000000000
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-value.md
+++ /dev/null
@@ -1,75 +0,0 @@
----
-{
- "title": "JSON_PARSE_NULLABLE_ERROR_TO_VALUE",
- "language": "zh-CN"
-}
----
-
-## 描述
-
-`JSON_PARSE_NULLABLE_ERROR_TO_VALUE` 函数用于解析一个 JSON 字符串为有效的 JSON 对象。如果输入的 JSON
字符串无效,它将返回用户指定的默认值,而不是抛出错误。如果输入为 `NULL`,则返回默认值。
-
-## 语法
-
-```sql
-JSON_PARSE_NULLABLE_ERROR_TO_VALUE( <str> , <default_value>)
-```
-## 别名
-
-- JSONB_PARSE_NULLABLE_ERROR_TO_VALUE
-
-## 必选参数
-
-| 参数 | 描述 |
-|------|------|
-| `<str>` | 需要解析的 JSON 格式的输入字符串。 |
-| `<default_value>` | 解析失败时返回的默认值。 |
-
-## 返回值
-如果输入字符串是有效的 JSON,返回对应的 JSON 对象。
-如果输入字符串无效或为 NULL,返回 default_value 参数指定的默认值。
-
-## 举例
-1. 有效的 JSON 字符串:
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_VALUE('{"name": "John", "age": 30}',
'default');
-
-
-```
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_VALUE('{"name": "John", "age": 30}', 'default')
|
-+---------------------------------------------------------------+
-| {"name": "John", "age": 30} |
-+---------------------------------------------------------------+
-
-
-```
-2. 无效的 JSON 字符串:
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_VALUE('{"name": "John", "age": }',
'default');
-
-
-```
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_VALUE('{"name": "John", "age": }', 'default') |
-+---------------------------------------------------------------+
-| default |
-+---------------------------------------------------------------+
-
-```
-3. 输入为 NULL:
-```sql
-SELECT JSON_PARSE_NULLABLE_ERROR_TO_VALUE(NULL, 'default');
-
-
-```
-```sql
-+---------------------------------------------------------------+
-| JSON_PARSE_NULLABLE_ERROR_TO_VALUE(NULL, 'default') |
-+---------------------------------------------------------------+
-| default |
-+---------------------------------------------------------------+
-
-```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable.md
deleted file mode 100644
index 4e2bd296146..00000000000
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable.md
+++ /dev/null
@@ -1,58 +0,0 @@
----
-{
- "title": "JSON_PARSE_NULLABLE",
- "language": "zh-CN"
-}
----
-
-## 描述
-
-`JSON_PARSE_NULLABLE` 函数用于解析一个 JSON 字符串为有效的 JSON 对象。如果输入字符串无效或为 NULL,它将返回
NULL,而不会抛出错误。
-
-## 语法
-
-```sql
-JSON_PARSE_NULLABLE( <str> )
-```
-## 别名
-
-- JSONB_PARSE_NULLABLE
-
-## 必选参数
-
-| 参数 | 描述 |
-|------|------|
-| `<str>` | 需要解析的 JSON 格式的输入字符串。 |
-
-## 返回值
-如果输入字符串是有效的 JSON,返回对应的 JSON 对象。
-如果输入字符串无效或为 NULL,返回 NULL。
-
-## 示例
-
-1.有效的 JSON 字符串:
-```sql
-SELECT JSON_PARSE_NULLABLE('{"name": "John", "age": 30}');
-```
-
-```sql
-+-------------------------------------------------------+
-| JSON_PARSE_NULLABLE('{"name": "John", "age": 30}') |
-+-------------------------------------------------------+
-| {"name": "John", "age": 30} |
-+-------------------------------------------------------+
-
-```
-2.无效的 JSON 字符串:
-```sql
-SELECT JSON_PARSE_NULLABLE('{"name": "John", "age": }');
-```
-
-```sql
-+-------------------------------------------------------+
-| JSON_PARSE_NULLABLE('{"name": "John", "age": }') |
-+-------------------------------------------------------+
-| NULL |
-+-------------------------------------------------------+
-
-```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-quote.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-quote.md
index be0c04c21f0..56de20ef9be 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-quote.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-quote.md
@@ -6,65 +6,89 @@
---
## 描述
-将 json_value 用双引号(")括起来,跳过其中包含的特殊转义字符。
+将输入的字符串参数用双引号包围,并对字符串中的特殊字符和控制字符进行转译,该函数的主要用途是将字符串转换为合法的 json 字符串。
+
+特殊字符包括:
+* 引号 (`"`)
+* 反斜杠 (`\`)
+* Backspace (`\b`)
+* 换行 (`\n`)
+* 回车 (`\r`)
+* 水平制表符 (`\t`)
+
+控制字符包括:
+* `CHAR(0)` 被转义为 `\u0000`
## 语法
```sql
-JSON_QUOTE (<a>)
+JSON_QUOTE (<str>)
```
## 参数
-| 参数 | 描述 |
-|------|---------------------|
-| `<a>` | 要括起来的 json_value 的值 |
-
+`<str>` 字符串类型,要括起来的值。
## 返回值
-返回一个 json_value。特殊情况如下:
-* 如果传入的参数为 NULL,返回 NULL。
-
-## 举例
+返回被双引号括起来的字符串
-```sql
-SELECT json_quote('null'), json_quote('"null"');
-```
+## 使用说明
+- 如果参数是 NULL 返回 NULL。
+- 如果参数中的字符是 转义符号(`\`) + 非转义字符的情况,转义符号会被删除,参考示例 4 和 5.
-```text
-+--------------------+----------------------+
-| json_quote('null') | json_quote('"null"') |
-+--------------------+----------------------+
-| "null" | "\"null\"" |
-+--------------------+----------------------+
-```
+## 示例
+1. 双引号被转义
+ ```sql
+ select json_quote('I am a "string" that contains double quotes.');
+ ```
+ ```
+ +------------------------------------------------------------+
+ | json_quote('I am a "string" that contains double quotes.') |
+ +------------------------------------------------------------+
+ | "I am a \"string\" that contains double quotes." |
+ +------------------------------------------------------------+
+ ```
+2. 特殊字符的转义
+ ```sql
+ select json_quote("\\ \b \n \r \t");
+ ```
+ ```
+ +------------------------------+
+ | json_quote("\\ \b \n \r \t") |
+ +------------------------------+
+ | "\\ \b \n \r \t" |
+ +------------------------------+
+ ```
-```sql
-SELECT json_quote('[1, 2, 3]');
-```
-```text
-+-------------------------+
-| json_quote('[1, 2, 3]') |
-+-------------------------+
-| "[1, 2, 3]" |
-+-------------------------+
-```
-```sql
-SELECT json_quote(null);
-```
-```text
-+------------------+
-| json_quote(null) |
-+------------------+
-| NULL |
-+------------------+
-```
+3. 控制字符字符转义
+ ```sql
+ select json_quote("\0");
+ ```
+ ```
+ +------------------+
+ | json_quote("\0") |
+ +------------------+
+ | "\u0000" |
+ +------------------+
+ ```
-```sql
-select json_quote("\n\b\r\t");
-```
-```text
-+------------------------+
-| json_quote('\n\b\r\t') |
-+------------------------+
-| "\n\b\r\t" |
-+------------------------+
-```
+4. 转义符号 + 非转义字符的情况
+ ```sql
+ select json_quote("\a");
+ ```
+ ```
+ +------------------+
+ | json_quote("\a") |
+ +------------------+
+ | "a" |
+ +------------------+
+ ```
+5. 非 0 的不可打印字符
+ ```sql
+ select json_quote("\1");
+ ```
+ ```
+ +------------------+
+ | json_quote("\1") |
+ +------------------+
+ | "1" |
+ +------------------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-replace.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-replace.md
index 7fa88eff211..bfcf7e49f1e 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-replace.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-replace.md
@@ -19,7 +19,7 @@ JSON_REPLACE (<json_object>, <path>, <value>[, <path>,
<value>, ...])
- `<value>` JSON 类型或其他 [`TO_JSON`](./to-json.md) 支持的类型,要替换的值。
## 返回值
-- Nullable(JSON) 返回被修改后的 JSON 对象
+- `Nullable(JSON)` 返回被修改后的 JSON 对象
## 使用说明
1. 需要注意的是,路径值对按从左到右的顺序进行评估。
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-search.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-search.md
index 1b8e6d960e2..44152d9f75c 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-search.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-search.md
@@ -20,7 +20,7 @@ JSON_SEARCH( <json_object>, <one_or_all>, <search_value> )
- `<search_value>`: String 类型,需要查找的值,搜索目标。
## 返回值
-Nullable(JSON): 根据参数 `<one_or_all>` 不同有两种情况:
+`Nullable(JSON)`: 根据参数 `<one_or_all>` 不同有两种情况:
1. 'one' 如果找到匹配的值,返回一个 JSON 路径,指向匹配的值。 如果没有找到匹配的值,返回 NULL。
2. 'all' 返回所有匹配值的路径,如果有多个值,以 JSON 数组的形式返回,如果没有匹配返回 NULL。
@@ -28,7 +28,7 @@ Nullable(JSON): 根据参数 `<one_or_all>` 不同有两种情况:
## 注意事项
- `one_or_all` 参数决定了是否查找所有匹配的值。'one' 会返回第一个匹配的路径,'all' 会返回所有匹配的路径。
如果是其他值,会得到报错。
- 如果没有找到匹配值,函数会返回 NULL。
-- `<json_object>`, `<one_or_all>`, `<search_value>` 任意一个为 NULL 值时返回 NULL.
+- `<json_object>`, `<one_or_all>`, `<search_value>` 任意一个为 NULL 时返回 NULL.
## 示例
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-set.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-set.md
index bd4c47596c0..ddffa4125d1 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-set.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-set.md
@@ -19,7 +19,7 @@ JSON_SET (<json_object>, <path>, <value>[, <path>, <value>,
...])
- `<value>` JSON 类型或其他 [`TO_JSON`](./to-json.md) 支持的类型,要插入的值。
## 返回值
-- Nullable(JSON) 返回被修改后的 JSON 对象
+- `Nullable(JSON)` 返回被修改后的 JSON 对象
## 使用说明
1. 当 `<path>` 指向的对象存在时,其行为和 [`JSON_REPLACE`](./json-replace.md) 一致,否则其行为和
[`JSON_INSERT`](./json-insert.md) 一致
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-unquote.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-unquote.md
index 6f40bff712f..3f6c69b3d66 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-unquote.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-unquote.md
@@ -6,107 +6,96 @@
---
## 描述
-这个函数将去掉 JSON 值中的引号,并将结果作为 utf8mb4 字符串返回。如果参数为 NULL,则返回 NULL。
+这个函数将去掉 JSON 值中的引号,并将结果作为字符串返回。如果参数为 NULL,则返回 NULL。
-在字符串中显示的如下转义序列将被识别,对于所有其他转义序列,反斜杠将被忽略。
+特殊字符包括:
+* 引号 (`"`)
+* 反斜杠 (`\`)
+* Backspace (`\b`)
+* 换行 (`\n`)
+* 回车 (`\r`)
+* 水平制表符 (`\t`)
-| 转义序列 | 序列表示的字符 |
-|----------|-------------------------------|
-| \" | 双引号 " |
-| \b | 退格字符 |
-| \f | 换页符 |
-| \n | 换行符 |
-| \r | 回车符 |
-| \t | 制表符 |
-| \\ | 反斜杠 \ |
-| \uxxxx | Unicode 值 XXXX 的 UTF-8 字节 |
+控制字符包括:
+* `CHAR(0)` 被转义为 `\u0000`
## 语法
```sql
-JSON_UNQUOTE (<a>)
+JSON_UNQUOTE (<str>)
```
## 参数
-| 参数 | 描述 |
-|------|--------------------------------------------------------|
-| `<a>` | 要去除引号的元素。 |
+- `<str>` 要去除引号的字符串。
## 返回值
-返回一个 utf8mb4 字符串。特殊情况如下:
+返回一个字符串。特殊情况如下:
* 如果传入的参数为 NULL,返回 NULL。
* 如果传入的参数不是一个带有双引号的值,则会返回值本身。
* 如果传入的参数不是一个字符串,则会被自动转换为字符串后,返回值本身。
## 举例
-```sql
-SELECT json_unquote('"doris"');
-```
-
-```text
-+-------------------------+
-| json_unquote('"doris"') |
-+-------------------------+
-| doris |
-+-------------------------+
-```
-```sql
-SELECT json_unquote('[1, 2, 3]');
-```
-```text
-+---------------------------+
-| json_unquote('[1, 2, 3]') |
-+---------------------------+
-| [1, 2, 3] |
-+---------------------------+
-```
-```sql
-SELECT json_unquote(null);
-```
-```text
-+--------------------+
-| json_unquote(NULL) |
-+--------------------+
-| NULL |
-+--------------------+
-```
-```sql
-SELECT json_unquote('"\\ttest"');
-```
-```text
-+--------------------------+
-| json_unquote('"\ttest"') |
-+--------------------------+
-| test |
-+--------------------------+
-```
-```sql
-select json_unquote('"doris');
-```
-```text
-+------------------------+
-| json_unquote('"doris') |
-+------------------------+
-| "doris |
-+------------------------+
-```
-```sql
-select json_unquote('doris');
-```
-```text
-+-----------------------+
-| json_unquote('doris') |
-+-----------------------+
-| doris |
-+-----------------------+
-```
-```sql
-select json_unquote(1);
-```
-```text
-+-----------------------------------------+
-| json_unquote(cast(1 as VARCHAR(65533))) |
-+-----------------------------------------+
-| 1 |
-+-----------------------------------------+
-```
+1. 字符串中的转义字符会被去掉
+ ```sql
+ select json_unquote('"I am a \\"string\\" that contains double quotes."');
+ ```
+ ```
+ +--------------------------------------------------------------------+
+ | json_unquote('"I am a \\"string\\" that contains double quotes."') |
+ +--------------------------------------------------------------------+
+ | I am a "string" that contains double quotes. |
+ +--------------------------------------------------------------------+
+ ```
+2. 特殊字符的转义
+ ```sql
+ select json_unquote('"\\\\ \\b \\n \\r \\t"');
+ ```
+ ```
+ +----------------------------------------+
+ | json_unquote('"\\\\ \\b \\n \\r \\t"') |
+ +----------------------------------------+
+ | \
+ |
+ +----------------------------------------+
+ ```
+ > 因为转义字符被去掉,所以会打印一些空白的字符(换行、退格、制表符等)
+3. 控制字符字符转义
+ ```sql
+ select json_unquote('"\\u0000"');
+ ```
+ ```
+ +---------------------------+
+ | json_unquote('"\\u0000"') |
+ +---------------------------+
+ | |
+ +---------------------------+
+ ```
+4. 非法的 json 字符串
+ ```sql
+ select json_unquote('"I am a "string" that contains double quotes."');
+ ```
+ ```
+ ERROR 1105 (HY000): errCode = 2, detailMessage = [RUNTIME_ERROR]Invalid
JSON text in argument 1 to function json_unquote: "I am a "string" that
contains double quotes."
+ ```
+5. 以引号开始但没有以引号结尾的情况
+ ```sql
+ select json_unquote('"I am a "string" that contains double quotes.');
+ ```
+ ```
+ +---------------------------------------------------------------+
+ | json_unquote('"I am a "string" that contains double quotes.') |
+ +---------------------------------------------------------------+
+ | "I am a "string" that contains double quotes. |
+ +---------------------------------------------------------------+
+ ```
+6. 以引号结尾的情况
+ ```sql
+ select json_unquote('I am a "string" that contains double quotes."');
+ ```
+ ```
+ +---------------------------------------------------------------+
+ | json_unquote('I am a "string" that contains double quotes."') |
+ +---------------------------------------------------------------+
+ | I am a "string" that contains double quotes." |
+ +---------------------------------------------------------------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-valid.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-valid.md
index 3d1af899e47..0c9c67f7f8f 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-valid.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-valid.md
@@ -7,7 +7,7 @@
## 描述
-JSON_VALID 函数返回 0 或 1 以表明是否为有效的 JSON, 如果参数是 NULL 则返回 NULL。
+JSON_VALID 函数用以判断字符串是否为有效的 JSON 字符串, 如果参数是 NULL 则返回 NULL。
## 语法
@@ -16,48 +16,45 @@ JSON_VALID( <str> )
```
## 必选参数
-| 参数 | 描述 |
-|------|------|
-| `<str>` | 需要解析的 JSON 格式的输入字符串。 |
+- `<str>` String 类型,需要判断的 JSON 格式字符串。
-## 别名
-
-- JSONB_VALID
## 举例
1. 正常 JSON 字符串
-
-```sql
-SELECT json_valid('{"k1":"v31","k2":300}');
-+-------------------------------------+
-| json_valid('{"k1":"v31","k2":300}') |
-+-------------------------------------+
-| 1 |
-+-------------------------------------+
-1 row in set (0.02 sec)
-```
+ ```sql
+ SELECT json_valid('{"k1":"v31","k2":300}');
+ ```
+ ```text
+ +-------------------------------------+
+ | json_valid('{"k1":"v31","k2":300}') |
+ +-------------------------------------+
+ | 1 |
+ +-------------------------------------+
+ 1 row in set (0.02 sec)
+ ```
2. 无效的 JSON 字符串
-
-```sql
-SELECT json_valid('invalid json');
-+----------------------------+
-| json_valid('invalid json') |
-+----------------------------+
-| 0 |
-+----------------------------+
-
-```
+ ```sql
+ SELECT json_valid('invalid json');
+ ```
+ ```text
+ +----------------------------+
+ | json_valid('invalid json') |
+ +----------------------------+
+ | 0 |
+ +----------------------------+
+
+ ```
3. NULL 参数
-
-```sql
-SELECT json_valid(NULL);
-+------------------+
-| json_valid(NULL) |
-+------------------+
-| NULL |
-+------------------+
-
-```
\ No newline at end of file
+ ```sql
+ SELECT json_valid(NULL);
+ ```
+ ```text
+ +------------------+
+ | json_valid(NULL) |
+ +------------------+
+ | NULL |
+ +------------------+
+ ```
\ No newline at end of file
diff --git a/sidebars.json b/sidebars.json
index 57fad9e0575..9bbfa419cdf 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -1471,6 +1471,7 @@
"sql-manual/sql-functions/scalar-functions/json-functions/get-json-int",
"sql-manual/sql-functions/scalar-functions/json-functions/get-json-string",
"sql-manual/sql-functions/scalar-functions/json-functions/json-array",
+
"sql-manual/sql-functions/scalar-functions/json-functions/json-array-ignore-null",
"sql-manual/sql-functions/scalar-functions/json-functions/json-contains",
"sql-manual/sql-functions/scalar-functions/json-functions/json-exists-path",
"sql-manual/sql-functions/scalar-functions/json-functions/json-extract",
@@ -1486,16 +1487,8 @@
"sql-manual/sql-functions/scalar-functions/json-functions/json-length",
"sql-manual/sql-functions/scalar-functions/json-functions/json-object",
"sql-manual/sql-functions/scalar-functions/json-functions/json-parse",
-
"sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-invalid",
"sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-null",
"sql-manual/sql-functions/scalar-functions/json-functions/json-parse-error-to-value",
-
"sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull",
-
"sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-invalid",
-
"sql-manual/sql-functions/scalar-functions/json-functions/json-parse-notnull-error-to-value",
-
"sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable",
-
"sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-invalid",
-
"sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-null",
-
"sql-manual/sql-functions/scalar-functions/json-functions/json-parse-nullable-error-to-value",
"sql-manual/sql-functions/scalar-functions/json-functions/json-quote",
"sql-manual/sql-functions/scalar-functions/json-functions/json-replace",
"sql-manual/sql-functions/scalar-functions/json-functions/json-search",
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]