JSON_ARRAY()
JSON_ARRAY constructs JSON array text from zero or more expressions.
Signature
JSON_ARRAY ( [ <json_array_value> [ , ...n ] ] [ <json_null_clause> ] [ RETURNING json ] )
<json_array_value> ::= value_expression
<json_null_clause> ::=
NULL ON NULL
| ABSENT ON NULLParameters
- json_array_value — An expression that defines the value of the element in the JSON array.
- json_null_clause — Can be used to control the behavior of `JSON_OBJECT` function when `value_expression` is `NULL`. The option `NULL ON NULL` converts the SQL `NULL` value into a JSON `NULL` value when generating the value of the element in the JSON array. The option `ABSENT ON NULL` will omit the element in the JSON array if the value is `NULL`. The default setting for this option is `ABSENT ON NULL`.
Examples
SELECT JSON_ARRAY();[]SELECT JSON_ARRAY('a', 1, 'b', 2);["a",1,"b",2]SELECT JSON_ARRAY('a', 1, 'b', NULL);["a",1,"b"]Run against SQL Server 16.0.4265.3 on 2026-09-13. This is the output we got, not the documentation’s.
Available on
- SQL Server 2022 and later
- Azure SQL Database
- Azure SQL Managed Instance
- Microsoft Fabric warehouse
Signature and description adapted from the Microsoft SQL documentation, used under the CC BY 4.0. SQL Server and Azure are trademarks of the Microsoft group of companies. This page is not affiliated with Microsoft.