Rechercher dans le manuel MySQL

12.17.4 Functions That Modify JSON Values

The functions in this section modify JSON values and return the result.

  • JSON_ARRAY_APPEND(json_doc, path, val[, path, val] ...)

    Appends values to the end of the indicated arrays within a JSON document and returns the result. Returns NULL if any argument is NULL. An error occurs if the json_doc argument is not a valid JSON document or any path argument is not a valid path expression or contains a * or ** wildcard.

    The path-value pairs are evaluated left to right. The document produced by evaluating one pair becomes the new value against which the next pair is evaluated.

    If a path selects a scalar or object value, that value is autowrapped within an array and the new value is added to that array. Pairs for which the path does not identify any value in the JSON document are ignored.

    1. mysql> SET @j = '["a", ["b", "c"], "d"]';
    2. mysql> SELECT JSON_ARRAY_APPEND(@j, '$[1]', 1);
    3. +----------------------------------+
    4. | JSON_ARRAY_APPEND(@j, '$[1]', 1) |
    5. +----------------------------------+
    6. | ["a", ["b", "c", 1], "d"]        |
    7. +----------------------------------+
    8. mysql> SELECT JSON_ARRAY_APPEND(@j, '$[0]', 2);
    9. +----------------------------------+
    10. | JSON_ARRAY_APPEND(@j, '$[0]', 2) |
    11. +----------------------------------+
    12. | [["a", 2], ["b", "c"], "d"]      |
    13. +----------------------------------+
    14. mysql> SELECT JSON_ARRAY_APPEND(@j, '$[1][0]', 3);
    15. +-------------------------------------+
    16. | JSON_ARRAY_APPEND(@j, '$[1][0]', 3) |
    17. +-------------------------------------+
    18. | ["a", [["b", 3], "c"], "d"]         |
    19. +-------------------------------------+
    20.  
    21. mysql> SET @j = '{"a": 1, "b": [2, 3], "c": 4}';
    22. mysql> SELECT JSON_ARRAY_APPEND(@j, '$.b', 'x');
    23. +------------------------------------+
    24. | JSON_ARRAY_APPEND(@j, '$.b', 'x')  |
    25. +------------------------------------+
    26. | {"a": 1, "b": [2, 3, "x"], "c": 4} |
    27. +------------------------------------+
    28. mysql> SELECT JSON_ARRAY_APPEND(@j, '$.c', 'y');
    29. +--------------------------------------+
    30. | JSON_ARRAY_APPEND(@j, '$.c', 'y')    |
    31. +--------------------------------------+
    32. | {"a": 1, "b": [2, 3], "c": [4, "y"]} |
    33. +--------------------------------------+
    34.  
    35. mysql> SET @j = '{"a": 1}';
    36. mysql> SELECT JSON_ARRAY_APPEND(@j, '$', 'z');
    37. +---------------------------------+
    38. | JSON_ARRAY_APPEND(@j, '$', 'z') |
    39. +---------------------------------+
    40. | [{"a": 1}, "z"]                 |
    41. +---------------------------------+

    In MySQL 5.7, this function was named JSON_APPEND(). That name is no longer supported in MySQL 8.0.

  • JSON_ARRAY_INSERT(json_doc, path, val[, path, val] ...)

    Updates a JSON document, inserting into an array within the document and returning the modified document. Returns NULL if any argument is NULL. An error occurs if the json_doc argument is not a valid JSON document or any path argument is not a valid path expression or contains a * or ** wildcard or does not end with an array element identifier.

    The path-value pairs are evaluated left to right. The document produced by evaluating one pair becomes the new value against which the next pair is evaluated.

    Pairs for which the path does not identify any array in the JSON document are ignored. If a path identifies an array element, the corresponding value is inserted at that element position, shifting any following values to the right. If a path identifies an array position past the end of an array, the value is inserted at the end of the array.

    1. mysql> SET @j = '["a", {"b": [1, 2]}, [3, 4]]';
    2. mysql> SELECT JSON_ARRAY_INSERT(@j, '$[1]', 'x');
    3. +------------------------------------+
    4. | JSON_ARRAY_INSERT(@j, '$[1]', 'x') |
    5. +------------------------------------+
    6. | ["a", "x", {"b": [1, 2]}, [3, 4]]  |
    7. +------------------------------------+
    8. mysql> SELECT JSON_ARRAY_INSERT(@j, '$[100]', 'x');
    9. +--------------------------------------+
    10. | JSON_ARRAY_INSERT(@j, '$[100]', 'x') |
    11. +--------------------------------------+
    12. | ["a", {"b": [1, 2]}, [3, 4], "x"]    |
    13. +--------------------------------------+
    14. mysql> SELECT JSON_ARRAY_INSERT(@j, '$[1].b[0]', 'x');
    15. +-----------------------------------------+
    16. | JSON_ARRAY_INSERT(@j, '$[1].b[0]', 'x') |
    17. +-----------------------------------------+
    18. | ["a", {"b": ["x", 1, 2]}, [3, 4]]       |
    19. +-----------------------------------------+
    20. mysql> SELECT JSON_ARRAY_INSERT(@j, '$[2][1]', 'y');
    21. +---------------------------------------+
    22. | JSON_ARRAY_INSERT(@j, '$[2][1]', 'y') |
    23. +---------------------------------------+
    24. | ["a", {"b": [1, 2]}, [3, "y", 4]]     |
    25. +---------------------------------------+
    26. mysql> SELECT JSON_ARRAY_INSERT(@j, '$[0]', 'x', '$[2][1]', 'y');
    27. +----------------------------------------------------+
    28. | JSON_ARRAY_INSERT(@j, '$[0]', 'x', '$[2][1]', 'y') |
    29. +----------------------------------------------------+
    30. | ["x", "a", {"b": [1, 2]}, [3, 4]]                  |
    31. +----------------------------------------------------+

    Earlier modifications affect the positions of the following elements in the array, so subsequent paths in the same JSON_ARRAY_INSERT() call should take this into account. In the final example, the second path inserts nothing because the path no longer matches anything after the first insert.

  • JSON_INSERT(json_doc, path, val[, path, val] ...)

    Inserts data into a JSON document and returns the result. Returns NULL if any argument is NULL. An error occurs if the json_doc argument is not a valid JSON document or any path argument is not a valid path expression or contains a * or ** wildcard.

    The path-value pairs are evaluated left to right. The document produced by evaluating one pair becomes the new value against which the next pair is evaluated.

    A path-value pair for an existing path in the document is ignored and does not overwrite the existing document value. A path-value pair for a nonexisting path in the document adds the value to the document if the path identifies one of these types of values:

    • A member not present in an existing object. The member is added to the object and associated with the new value.

    • A position past the end of an existing array. The array is extended with the new value. If the existing value is not an array, it is autowrapped as an array, then extended with the new value.

    Otherwise, a path-value pair for a nonexisting path in the document is ignored and has no effect.

    For a comparison of JSON_INSERT(), JSON_REPLACE(), and JSON_SET(), see the discussion of JSON_SET().

    1. mysql> SET @j = '{ "a": 1, "b": [2, 3]}';
    2. mysql> SELECT JSON_INSERT(@j, '$.a', 10, '$.c', '[true, false]');
    3. +----------------------------------------------------+
    4. | JSON_INSERT(@j, '$.a', 10, '$.c', '[true, false]') |
    5. +----------------------------------------------------+
    6. | {"a": 1, "b": [2, 3], "c": "[true, false]"}        |
    7. +----------------------------------------------------+

    The third and final value listed in the result is a quoted string and not an array like the second one (which is not quoted in the output); no casting of values to the JSON type is performed. To insert the array as an array, you must perform such casts explicitly, as shown here:

    1. mysql> SELECT JSON_INSERT(@j, '$.a', 10, '$.c', CAST('[true, false]' AS JSON));
    2. +------------------------------------------------------------------+
    3. | JSON_INSERT(@j, '$.a', 10, '$.c', CAST('[true, false]' AS JSON)) |
    4. +------------------------------------------------------------------+
    5. | {"a": 1, "b": [2, 3], "c": [true, false]}                        |
    6. +------------------------------------------------------------------+
    7. 1 row in set (0.00 sec)
  • JSON_MERGE(json_doc, json_doc[, json_doc] ...)

    Merges two or more JSON documents. Synonym for JSON_MERGE_PRESERVE(); deprecated in MySQL 8.0.3 and subject to removal in a future release.

    1. mysql> SELECT JSON_MERGE('[1, 2]', '[true, false]');
    2. +---------------------------------------+
    3. | JSON_MERGE('[1, 2]', '[true, false]') |
    4. +---------------------------------------+
    5. | [1, 2, true, false]                   |
    6. +---------------------------------------+
    7. 1 row in set, 1 warning (0.00 sec)
    8.  
    9. mysql> SHOW WARNINGS\G
    10. *************************** 1. row ***************************
    11.   Level: Warning
    12.    Code: 1287
    13. Message: 'JSON_MERGE' is deprecated and will be removed in a future release. \
    14.  Please use JSON_MERGE_PRESERVE/JSON_MERGE_PATCH instead
    15. 1 row in set (0.00 sec)

    For additional examples, see the entry for JSON_MERGE_PRESERVE().

  • JSON_MERGE_PATCH(json_doc, json_doc[, json_doc] ...)

    Performs an RFC 7396 compliant merge of two or more JSON documents and returns the merged result, without preserving members having duplicate keys. Raises an error if at least one of the documents passed as arguments to this function is not valid.

    Note

    For an explanation and example of the differences between this function and JSON_MERGE_PRESERVE(), see JSON_MERGE_PATCH() compared with JSON_MERGE_PRESERVE().

    JSON_MERGE_PATCH() performs a merge as follows:

    1. If the first argument is not an object, the result of the merge is the same as if an empty object had been merged with the second argument.

    2. If the second argument is not an object, the result of the merge is the second argument.

    3. If both arguments are objects, the result of the merge is an object with the following members:

      • All members of the first object which do not have a corresponding member with the same key in the second object.

      • All members of the second object which do not have a corresponding key in the first object, and whose value is not the JSON null literal.

      • All members with a key that exists in both the first and the second object, and whose value in the second object is not the JSON null literal. The values of these members are the results of recursively merging the value in the first object with the value in the second object.

    For additional information, see Normalization, Merging, and Autowrapping of JSON Values.

    1. mysql> SELECT JSON_MERGE_PATCH('[1, 2]', '[true, false]');
    2. +---------------------------------------------+
    3. | JSON_MERGE_PATCH('[1, 2]', '[true, false]') |
    4. +---------------------------------------------+
    5. | [true, false]                               |
    6. +---------------------------------------------+
    7.  
    8. mysql> SELECT JSON_MERGE_PATCH('{"name": "x"}', '{"id": 47}');
    9. +-------------------------------------------------+
    10. | JSON_MERGE_PATCH('{"name": "x"}', '{"id": 47}') |
    11. +-------------------------------------------------+
    12. | {"id": 47, "name": "x"}                         |
    13. +-------------------------------------------------+
    14.  
    15. mysql> SELECT JSON_MERGE_PATCH('1', 'true');
    16. +-------------------------------+
    17. | JSON_MERGE_PATCH('1', 'true') |
    18. +-------------------------------+
    19. | true                          |
    20. +-------------------------------+
    21.  
    22. mysql> SELECT JSON_MERGE_PATCH('[1, 2]', '{"id": 47}');
    23. +------------------------------------------+
    24. | JSON_MERGE_PATCH('[1, 2]', '{"id": 47}') |
    25. +------------------------------------------+
    26. | {"id": 47}                               |
    27. +------------------------------------------+
    28.  
    29. mysql> SELECT JSON_MERGE_PATCH('{ "a": 1, "b":2 }',
    30.      >     '{ "a": 3, "c":4 }');
    31. +-----------------------------------------------------------+
    32. | JSON_MERGE_PATCH('{ "a": 1, "b":2 }','{ "a": 3, "c":4 }') |
    33. +-----------------------------------------------------------+
    34. | {"a": 3, "b": 2, "c": 4}                                  |
    35. +-----------------------------------------------------------+
    36.  
    37. mysql> SELECT JSON_MERGE_PATCH('{ "a": 1, "b":2 }','{ "a": 3, "c":4 }',
    38.      >     '{ "a": 5, "d":6 }');
    39. +-------------------------------------------------------------------------------+
    40. | JSON_MERGE_PATCH('{ "a": 1, "b":2 }','{ "a": 3, "c":4 }','{ "a": 5, "d":6 }') |
    41. +-------------------------------------------------------------------------------+
    42. | {"a": 5, "b": 2, "c": 4, "d": 6}                                              |
    43. +-------------------------------------------------------------------------------+

    You can use this function to remove a member by specifying null as the value of the same member in the seond argument, as shown here:

    1. mysql> SELECT JSON_MERGE_PATCH('{"a":1, "b":2}', '{"b":null}');
    2. +--------------------------------------------------+
    3. | JSON_MERGE_PATCH('{"a":1, "b":2}', '{"b":null}') |
    4. +--------------------------------------------------+
    5. | {"a": 1}                                         |
    6. +--------------------------------------------------+

    This example shows that the function operates in a recursive fashion; that is, values of members are not limited to scalars, but rather can themselves be JSON documents:

    1. mysql> SELECT JSON_MERGE_PATCH('{"a":{"x":1}}', '{"a":{"y":2}}');
    2. +----------------------------------------------------+
    3. | JSON_MERGE_PATCH('{"a":{"x":1}}', '{"a":{"y":2}}') |
    4. +----------------------------------------------------+
    5. | {"a": {"x": 1, "y": 2}}                            |
    6. +----------------------------------------------------+

    JSON_MERGE_PATCH() is supported in MySQL 8.0.3 and later.

    JSON_MERGE_PATCH() compared with JSON_MERGE_PRESERVE().  The behavior of JSON_MERGE_PATCH() is the same as that of JSON_MERGE_PRESERVE(), with the following two exceptions:

    • JSON_MERGE_PATCH() removes any member in the first object with a matching key in the second object, provided that the value associated with the key in the second object is not JSON null.

    • If the second object has a member with a key matching a member in the first object, JSON_MERGE_PATCH() replaces the value in the first object with the value in the second object, whereas JSON_MERGE_PRESERVE() appends the second value to the first value.

    This example compares the results of merging the same 3 JSON objects, each having a matching key "a", with each of these two functions:

    1. mysql> SET @x = '{ "a": 1, "b": 2 }',
    2.      >     @y = '{ "a": 3, "c": 4 }',
    3.      >     @z = '{ "a": 5, "d": 6 }';
    4.  
    5. mysql> SELECT  JSON_MERGE_PATCH(@x, @y, @z)    AS Patch,
    6.     ->         JSON_MERGE_PRESERVE(@x, @y, @z) AS Preserve\G
    7. *************************** 1. row ***************************
    8.    Patch: {"a": 5, "b": 2, "c": 4, "d": 6}
    9. Preserve: {"a": [1, 3, 5], "b": 2, "c": 4, "d": 6}
  • JSON_MERGE_PRESERVE(json_doc, json_doc[, json_doc] ...)

    Merges two or more JSON documents and returns the merged result. Returns NULL if any argument is NULL. An error occurs if any argument is not a valid JSON document.

    Merging takes place according to the following rules. For additional information, see Normalization, Merging, and Autowrapping of JSON Values.

    • Adjacent arrays are merged to a single array.

    • Adjacent objects are merged to a single object.

    • A scalar value is autowrapped as an array and merged as an array.

    • An adjacent array and object are merged by autowrapping the object as an array and merging the two arrays.

    1. mysql> SELECT JSON_MERGE_PRESERVE('[1, 2]', '[true, false]');
    2. +------------------------------------------------+
    3. | JSON_MERGE_PRESERVE('[1, 2]', '[true, false]') |
    4. +------------------------------------------------+
    5. | [1, 2, true, false]                            |
    6. +------------------------------------------------+
    7.  
    8. mysql> SELECT JSON_MERGE_PRESERVE('{"name": "x"}', '{"id": 47}');
    9. +----------------------------------------------------+
    10. | JSON_MERGE_PRESERVE('{"name": "x"}', '{"id": 47}') |
    11. +----------------------------------------------------+
    12. | {"id": 47, "name": "x"}                            |
    13. +----------------------------------------------------+
    14.  
    15. mysql> SELECT JSON_MERGE_PRESERVE('1', 'true');
    16. +----------------------------------+
    17. | JSON_MERGE_PRESERVE('1', 'true') |
    18. +----------------------------------+
    19. | [1, true]                        |
    20. +----------------------------------+
    21.  
    22. mysql> SELECT JSON_MERGE_PRESERVE('[1, 2]', '{"id": 47}');
    23. +---------------------------------------------+
    24. | JSON_MERGE_PRESERVE('[1, 2]', '{"id": 47}') |
    25. +---------------------------------------------+
    26. | [1, 2, {"id": 47}]                          |
    27. +---------------------------------------------+
    28.  
    29. mysql> SELECT JSON_MERGE_PRESERVE('{ "a": 1, "b": 2 }',
    30.      >    '{ "a": 3, "c": 4 }');
    31. +--------------------------------------------------------------+
    32. | JSON_MERGE_PRESERVE('{ "a": 1, "b": 2 }','{ "a": 3, "c":4 }') |
    33. +--------------------------------------------------------------+
    34. | {"a": [1, 3], "b": 2, "c": 4}                                |
    35. +--------------------------------------------------------------+
    36.  
    37. mysql> SELECT JSON_MERGE_PRESERVE('{ "a": 1, "b": 2 }','{ "a": 3, "c": 4 }',
    38.      >    '{ "a": 5, "d": 6 }');
    39. +----------------------------------------------------------------------------------+
    40. | JSON_MERGE_PRESERVE('{ "a": 1, "b": 2 }','{ "a": 3, "c": 4 }','{ "a": 5, "d": 6 }') |
    41. +----------------------------------------------------------------------------------+
    42. | {"a": [1, 3, 5], "b": 2, "c": 4, "d": 6}                                         |
    43. +----------------------------------------------------------------------------------+

    This function was added in MySQL 8.0.3 as a synonym for JSON_MERGE(). The JSON_MERGE() function is now deprecated, and is subject to removal in a future release of MySQL.

    This function is similar to but differs from JSON_MERGE_PATCH() in significant respects; see JSON_MERGE_PATCH() compared with JSON_MERGE_PRESERVE(), for more information.

  • JSON_REMOVE(json_doc, path[, path] ...)

    Removes data from a JSON document and returns the result. Returns NULL if any argument is NULL. An error occurs if the json_doc argument is not a valid JSON document or any path argument is not a valid path expression or is $ or contains a * or ** wildcard.

    The path arguments are evaluated left to right. The document produced by evaluating one path becomes the new value against which the next path is evaluated.

    It is not an error if the element to be removed does not exist in the document; in that case, the path does not affect the document.

    1. mysql> SET @j = '["a", ["b", "c"], "d"]';
    2. mysql> SELECT JSON_REMOVE(@j, '$[1]');
    3. +-------------------------+
    4. | JSON_REMOVE(@j, '$[1]') |
    5. +-------------------------+
    6. | ["a", "d"]              |
    7. +-------------------------+
  • JSON_REPLACE(json_doc, path, val[, path, val] ...)

    Replaces existing values in a JSON document and returns the result. Returns NULL if any argument is NULL. An error occurs if the json_doc argument is not a valid JSON document or any path argument is not a valid path expression or contains a * or ** wildcard.

    The path-value pairs are evaluated left to right. The document produced by evaluating one pair becomes the new value against which the next pair is evaluated.

    A path-value pair for an existing path in the document overwrites the existing document value with the new value. A path-value pair for a nonexisting path in the document is ignored and has no effect.

    In MySQL 8.0.4, the optimizer can perform a partial, in-place update of a JSON column instead of removing the old document and writing the new document in its entirety to the column. This optimization can be performed for an update statement that uses the JSON_REPLACE() function and meets the conditions outlined in Partial Updates of JSON Values.

    For a comparison of JSON_INSERT(), JSON_REPLACE(), and JSON_SET(), see the discussion of JSON_SET().

    1. mysql> SET @j = '{ "a": 1, "b": [2, 3]}';
    2. mysql> SELECT JSON_REPLACE(@j, '$.a', 10, '$.c', '[true, false]');
    3. +-----------------------------------------------------+
    4. | JSON_REPLACE(@j, '$.a', 10, '$.c', '[true, false]') |
    5. +-----------------------------------------------------+
    6. | {"a": 10, "b": [2, 3]}                              |
    7. +-----------------------------------------------------+
  • JSON_SET(json_doc, path, val[, path, val] ...)

    Inserts or updates data in a JSON document and returns the result. Returns NULL if any argument is NULL or path, if given, does not locate an object. An error occurs if the json_doc argument is not a valid JSON document or any path argument is not a valid path expression or contains a * or ** wildcard.

    The path-value pairs are evaluated left to right. The document produced by evaluating one pair becomes the new value against which the next pair is evaluated.

    A path-value pair for an existing path in the document overwrites the existing document value with the new value. A path-value pair for a nonexisting path in the document adds the value to the document if the path identifies one of these types of values:

    • A member not present in an existing object. The member is added to the object and associated with the new value.

    • A position past the end of an existing array. The array is extended with the new value. If the existing value is not an array, it is autowrapped as an array, then extended with the new value.

    Otherwise, a path-value pair for a nonexisting path in the document is ignored and has no effect.

    In MySQL 8.0.4, the optimizer can perform a partial, in-place update of a JSON column instead of removing the old document and writing the new document in its entirety to the column. This optimization can be performed for an update statement that uses the JSON_SET() function and meets the conditions outlined in Partial Updates of JSON Values.

    The JSON_SET(), JSON_INSERT(), and JSON_REPLACE() functions are related:

    The following examples illustrate these differences, using one path that does exist in the document ($.a) and another that does not exist ($.c):

    1. mysql> SET @j = '{ "a": 1, "b": [2, 3]}';
    2. mysql> SELECT JSON_SET(@j, '$.a', 10, '$.c', '[true, false]');
    3. +-------------------------------------------------+
    4. | JSON_SET(@j, '$.a', 10, '$.c', '[true, false]') |
    5. +-------------------------------------------------+
    6. | {"a": 10, "b": [2, 3], "c": "[true, false]"}    |
    7. +-------------------------------------------------+
    8. mysql> SELECT JSON_INSERT(@j, '$.a', 10, '$.c', '[true, false]');
    9. +----------------------------------------------------+
    10. | JSON_INSERT(@j, '$.a', 10, '$.c', '[true, false]') |
    11. +----------------------------------------------------+
    12. | {"a": 1, "b": [2, 3], "c": "[true, false]"}        |
    13. +----------------------------------------------------+
    14. mysql> SELECT JSON_REPLACE(@j, '$.a', 10, '$.c', '[true, false]');
    15. +-----------------------------------------------------+
    16. | JSON_REPLACE(@j, '$.a', 10, '$.c', '[true, false]') |
    17. +-----------------------------------------------------+
    18. | {"a": 10, "b": [2, 3]}                              |
    19. +-----------------------------------------------------+
  • JSON_UNQUOTE(json_val)

    Unquotes JSON value and returns the result as a utf8mb4 string. Returns NULL if the argument is NULL. An error occurs if the value starts and ends with double quotes but is not a valid JSON string literal.

    Within a string, certain sequences have special meaning unless the NO_BACKSLASH_ESCAPES SQL mode is enabled. Each of these sequences begins with a backslash (\), known as the escape character. MySQL recognizes the escape sequences shown in Table 12.22, “JSON_UNQUOTE() Special Character Escape Sequences”. For all other escape sequences, backslash is ignored. That is, the escaped character is interpreted as if it was not escaped. For example, \x is just x. These sequences are case-sensitive. For example, \b is interpreted as a backspace, but \B is interpreted as B.

    Table 12.22 JSON_UNQUOTE() Special Character 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

    Two simple examples of the use of this function are shown here:

    1. mysql> SET @j = '"abc"';
    2. mysql> SELECT @j, JSON_UNQUOTE(@j);
    3. +-------+------------------+
    4. | @j    | JSON_UNQUOTE(@j) |
    5. +-------+------------------+
    6. | "abc" | abc              |
    7. +-------+------------------+
    8. mysql> SET @j = '[1, 2, 3]';
    9. mysql> SELECT @j, JSON_UNQUOTE(@j);
    10. +-----------+------------------+
    11. | @j        | JSON_UNQUOTE(@j) |
    12. +-----------+------------------+
    13. | [1, 2, 3] | [1, 2, 3]        |
    14. +-----------+------------------+

    The following set of examples shows how JSON_UNQUOTE handles escapes with NO_BACKSLASH_ESCAPES disabled and enabled:

    1. mysql> SELECT @@sql_mode;
    2. +------------+
    3. | @@sql_mode |
    4. +------------+
    5. |            |
    6. +------------+
    7.  
    8. mysql> SELECT JSON_UNQUOTE('"\\t\\u0032"');
    9. +------------------------------+
    10. | JSON_UNQUOTE('"\\t\\u0032"') |
    11. +------------------------------+
    12. |       2                           |
    13. +------------------------------+
    14.  
    15. mysql> SET @@sql_mode = 'NO_BACKSLASH_ESCAPES';
    16. mysql> SELECT JSON_UNQUOTE('"\\t\\u0032"');
    17. +------------------------------+
    18. | JSON_UNQUOTE('"\\t\\u0032"') |
    19. +------------------------------+
    20. | \t\u0032                     |
    21. +------------------------------+
    22.  
    23. mysql> SELECT JSON_UNQUOTE('"\t\u0032"');
    24. +----------------------------+
    25. | JSON_UNQUOTE('"\t\u0032"') |
    26. +----------------------------+
    27. |       2                         |
    28. +----------------------------+

Zoek in de MySQL-handleiding

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-json-modification-functions.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:en Manuel MySQL : https://dev.mysql.com/

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut