Inserts a value at a specified position within a JSON array. Elements after the insertion point shift to the right.
JSONDiperbarui: 13 Jun 2026JSON_ARRAY_INSERT(json_doc, path, val[, path, val] ...)The source JSON document
Path with array index ($.arr[index])
The value to insert
1 SELECT JSON_ARRAY_INSERT('["a", "b", "c"]', '$[1]', 'x') AS result;
Inserts 'x' at index 1.
1 SELECT JSON_ARRAY_INSERT('[1, 2, 3]', '$[0]', 0) AS result;
Inserts at the beginning of the array (unshift).
1 SELECT JSON_ARRAY_INSERT('{"items": [1, 2, 3]}', '$.items[1]', 1.5) AS result;
Inserts into a nested array.
Sudah paham JSON_ARRAY_INSERT? Latih langsung di browser
Latihan interaktif, langsung di browser.