JSON_CONTAINS
JSON containment test
What changes
- Input
- JSON text, search value, optional path and mode
- Output or change
- 1/0
- Return type
- Returns an int value of 0, 1, or NULL. A value of 1 indicates that the specified search value was contained within the target JSON document, or 0 otherwise. The JSON_CONTAINS function returns NULL if
Syntax at a glance
JSON_CONTAINS( target_expression , search_value_expression [ , path_expression ] [ , search_mode ] )
Work example
Test whether a JSON document contains a value at a path before shaping a result.
Use a precise path and test scalar, array, missing-path, and null cases.
Check your work JSON_CONTAINS is a SQL Server 2025 function and its path and search mode affect the match.
Open Microsoft Learn for full syntax, permissions, and details for your version.