SQLite 3 reference · JSON Functions

SQLite JSON_ARRAY() Function

Build a JSON array from the arguments. SQL NULL becomes JSON null; numbers stay numbers.

SQLite 3 Since 3.9.0

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

json_array(value1, value2, ...)

Parameters

ParameterDescription
values The array elements.

Return value

JSON array text.

Examples

Build an arrayTry it yourself
SELECT json_array(1, 'two', NULL, 4.5) AS arr;

Output

arr
[1,"two",null,4.5]
From columnsTry it yourself
SELECT json_array(name, price) AS pair
FROM products
LIMIT 2;

Output

pair
["SQL for Beginners",29.99]
["Clean Code",37.5]

Version history

VersionChange
SQLite 3.9.0Added
SQLite 3.38.0Built in by default; earlier versions needed the JSON1 extension.

In other languages

Was this page helpful?