Skip to content

Commit 76697b3

Browse files
Merge pull request #36247 from WilliamDAssafMSFT/20260114-json-valid
20260114 json valid
2 parents 73749b1 + 7538e2b commit 76697b3

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

docs/t-sql/data-types/json-data-type.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: The native JSON data type provides advantages for storing JSON data
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
66
ms.reviewer: randolphwest, jovanpop, umajay
7-
ms.date: 11/18/2025
7+
ms.date: 01/14/2026
88
ms.service: sql
99
ms.subservice: t-sql
1010
ms.topic: reference
@@ -102,6 +102,26 @@ SET d.modify('$.b', 'def')
102102
WHERE id = 1;
103103
```
104104

105+
## Valid data
106+
107+
Input to the **json** data type must be a JSON object or a JSON array. Scalars, booleans, and `NULL` values are not supported. The JSON data type conforms to IETF RFC 4627 which allows only a JSON object or array. The **json** data type and all JSON functions only work with IETF RFC 4627 compliant JSON documents.
108+
109+
The [ISJSON](../functions/isjson-transact-sql.md) function can be used to validate a string that contains JSON document conforms to IETF RFC 8259. An IETF RFC 8259 conformant JSON document contains only a JSON scalar value at top level.
110+
111+
For example:
112+
113+
```sql
114+
DECLARE @true JSON = 'true'; -- invalid
115+
DECLARE @false JSON = 'false'; -- invalid
116+
DECLARE @number JSON = '1234.56'; -- invalid
117+
DECLARE @string JSON = '"contoso"'; -- invalid
118+
DECLARE @null JSON = 'null' -- invalid
119+
120+
DECLARE @null JSON = NULL -- valid
121+
DECLARE @object JSON = '{}' -- valid
122+
DECLARE @array JSON = '[]' -- valid
123+
```
124+
105125
## Function support
106126

107127
All JSON functions support the **json** data type with no code changes or usage difference necessary.

docs/t-sql/functions/isjson-transact-sql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ If the *json_type_constraint* is specified then the function checks for the JSON
6262
|`OBJECT`|Tests for a valid JSON object|
6363
|`SCALAR`|Tests for a valid JSON scalar – number or string|
6464

65-
The **json_type_constraint** value SCALAR can be used to test for IETF RFC 8259 conformant JSON document that contains only a JSON scalar value at top level. A JSON document that doesn't contain a JSON scalar value at top level conforms with IETF RFC 4627.
65+
The `json_type_constraint` value SCALAR can be used to test for IETF RFC 8259 conformant JSON document that contains only a JSON scalar value at top level. A JSON document that doesn't contain a JSON scalar value at top level conforms with IETF RFC 4627.
6666

6767
Does not return errors.
6868

0 commit comments

Comments
 (0)