SQL Flow Field Guide

JSON_OBJECT

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

JSON extract, test, modify or construct

What changes

Input
JSON text or values
Output or change
scalar, fragment, or constructed JSON
Return type
Returns a valid JSON object string of nvarchar(max) type. If the RETURNING json option is included then the JSON object is returned as json type. For more info about what you see in the output of the

Syntax at a glance

JSON_OBJECT ( [ <json_key_value> [ , ...n ] ] [ json_null_clause ] [ RETURNING json ] )

Work example

Construct a JSON object from explicit key and value expressions.

Use stable keys and decide whether null values should be included or omitted.

Check your work The null clause changes object shape and the native JSON return option depends on version support.

Open Microsoft Learn for full syntax, permissions, and details for your version.