Skip to content

Conversation

@jing8956
Copy link
Contributor

DECLARE @true JSON = 'true'; -- invalid
DECLARE @false JSON = 'false'; -- invalid 
DECLARE @number JSON = '1234.56'; -- invalid 
DECLARE @string JSON = '"foo"'; -- invalid 
DECLARE @null JSON = 'null' -- invalid

DECLARE @object JSON = '{}' -- valid 
DECLARE @array JSON = '[]' -- valid

@prmerger-automator
Copy link
Contributor

@jing8956 : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change.

@learn-build-service-prod
Copy link
Contributor

Learn Build status updates of commit 826d741:

✅ Validation status: passed

File Status Preview URL Details
docs/t-sql/data-types/json-data-type.md ✅Succeeded

For more details, please refer to the build report.

@WilliamDAssafMSFT
Copy link
Contributor

@jing8956 Thanks for creating a pull request on Microsoft documentation. This appears to be pretty straightforward, can you explain further why this distinction would be necessary about the json data type? Also, top-level data type is not a Microsoft docs concept, can you explain further what you mean by "top-level"?

@Court72 Court72 requested a review from Copilot January 14, 2026 16:46
@Court72
Copy link
Contributor

Court72 commented Jan 14, 2026

@WilliamDAssafMSFT

Important: When the changes are ready for publication, adding a #sign-off comment is the best way to signal that the PR is ready for the review team to merge.

#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

@prmerger-automator prmerger-automator bot added the aq-pr-triaged tracking label for the PR review team label Jan 14, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds important documentation about a limitation of the JSON data type in SQL Server 2025. Specifically, it clarifies that only JSON objects and arrays are supported as top-level values, while JSON scalars (strings, numbers), booleans, and null values are not supported at the top level.

Changes:

  • Added a new sentence documenting the constraint that JSON data type only accepts objects or arrays as top-level types
  • The new limitation is placed in the appropriate Limitations section before the Size limitations subsection


- In [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)], the `OPENJSON()` function does support **json**. For more information, see [Key JSON capabilities in SQL Server 2025](../../relational-databases/json/json-data-sql-server.md#key-json-capabilities).

The top-level type must be a JSON Object or a JSON Array. Scalars, booleans, and null values are not supported.
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sentence uses mixed capitalization for JSON terms. According to JSON specification terminology, "object" and "array" should be lowercase when referring to JSON structural elements, not capitalized. Consider changing "JSON Object" and "JSON Array" to "JSON object" and "JSON array" for consistency with standard JSON terminology.

Copilot uses AI. Check for mistakes.
@jing8956
Copy link
Contributor Author

jing8956 commented Jan 14, 2026

@WilliamDAssafMSFT Sorry for being pretty straightforward.
I can't speak English, I can only communicate with the help of a translator. Therefore, I try to avoid writing long texts.

According to the definition in RFC 8259, Text that contains only a value is also a valid JSON.

This is very useful for dynamic forms; some forms store complex objects, while others only need to store a single scalar.

Ever since MS-SQL introduced a dedicated JSON data type, I have always thought it would be a new solution to completely replace the previous use of varchar or nvarchar for storing JSON data. That was until today, when I failed to store a JSON boolean value in a column with the JSON data type.

Based on my actual testing on SQL Server 2025 and Azure SQL, the JSON data type is only a subset of the JSON.

Regarding the explanation of 'top-level,', ISJSON (Transact-SQL) has a longer explanation:

IETF RFC 8259 conformant JSON document that contains only a JSON scalar value at top level.

If you feel that a longer explanation is needed to clarify this, please feel free to modify my pull request.

@WilliamDAssafMSFT
Copy link
Contributor

Thanks @jing8956 this is a good contribution to the doc. Will bring this commit internally and add to it. This doc flight is in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants