SQLite Forum

json_append array with multiple values
Login
Array concatenation could be achieved like this by using a combination of the `json_each` table-valued function with the `json_group_array` aggregate function.

e.g.

```sql
CREATE TABLE example(items JSON);
INSERT INTO example(items) VALUES('{"id":3,"items":{"category":"foo","items":[{"type":1,"amount":1},null,null,null,null]}}');

UPDATE example
   SET items = json_set(items, '$.items.items',
		                (SELECT json_group_array(value)
		                   FROM (SELECT value
		                           FROM json_each(items, '$.items.items')
		                          UNION ALL
		                         SELECT value
		                           FROM json_each('[null, null, null, null, null, null, null, null, null, null]')
		                          LIMIT 10)));

SELECT *
  FROM example;

-- {"id":3,"items":{"category":"foo","items":[{"type":1,"amount":1},null,null,null,null,null,null,null,null,null]}}
```