Skip to content

Conversation

@bpp-incom
Copy link
Contributor

Described the limitation of the JSON type.

@bpp-incom
Copy link
Contributor Author

If you want to test it yourself you can run this code (it requires that the cross join product of sys.all_objects produces more than 65535 rows):


DECLARE @data NVARCHAR(MAX)
;WITH cte AS (
SELECT ROW_NUMBER() OVER(ORDER BY (SELECT 1)) AS rn FROM sys.all_objects t1 CROSS JOIN sys.all_objects t2
)
SELECT @data = (SELECT * FROM cte
WHERE rn <= 70000
FOR JSON AUTO)
SELECT @data

SELECT CAST(@data AS json)
SELECT TRY_CAST(@data AS json)

@learn-build-service-prod
Copy link
Contributor

Learn Build status updates of commit 00bc200:

⚠️ Validation status: warnings

File Status Preview URL Details
docs/t-sql/data-types/json-data-type.md ⚠️Warning Details

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

  • Line 1, Column 1: [Warning: author-missing - See documentation] Missing required attribute: 'author'. Add the current author's GitHub ID.
  • Line 1, Column 1: [Warning: title-missing - See documentation] Missing required attribute: 'title'. Add a title string to show in search engine results.
  • Line 1, Column 1: [Warning: ms-author-missing - See documentation] Missing required attribute: 'ms.author'. Add the current author's Microsoft alias.
  • Line 1, Column 1: [Warning: ms-topic-missing - See documentation] Missing required attribute: 'ms.topic'.
  • Line 18, Column 1: [Warning: h1-not-first - See documentation] Markdown content is not allowed before H1 'JSON data type'.
  • Line 1, Column 1: [Suggestion: ms-date-missing - See documentation] Missing required attribute: 'ms.date'.
  • Line 1, Column 1: [Suggestion: description-missing - See documentation] Missing required attribute: 'description'.
  • Line 1, Column 1: [Suggestion: ms-service-suggested] Missing required attribute: 'ms.service'. ms.service is suggested for Yaml:Mime type: Module.

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

@v-dirichards
Copy link
Contributor

@WilliamDAssafMSFT

Can you review the proposed changes?

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 Nov 4, 2025
@v-dirichards v-dirichards requested a review from Copilot November 4, 2025 15:48
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 PR documents a limitation of the JSON data type in SQL Server, specifically regarding the maximum number of items allowed in a single object or array. The documentation adds a new section explaining that JSON objects and arrays are limited to 65,535 items (the maximum value of a 16-bit unsigned integer) and describes the error that occurs when this limit is exceeded.

  • Added documentation about the 65,535 item limit for JSON objects/arrays
  • Included example error message that users will encounter when exceeding the limit
  • Noted that TRY_CAST also throws the same error

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1,4 +1,4 @@
---
<img width="100" height="19" alt="image" src="https://github.com/user-attachments/assets/97427a9d-b373-460a-a4d7-1bd32ca6fb42" />---
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

The image tag appears to have been accidentally inserted before the document frontmatter delimiter. This will break the YAML frontmatter parsing. The line should only contain '---'.

Copilot uses AI. Check for mistakes.

- 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).

### Size limit for Items in one object/array
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

Corrected capitalization of 'Items' to 'items' in the heading for consistency with standard heading capitalization.

Suggested change
### Size limit for Items in one object/array
### Size limit for items in one object/array

Copilot uses AI. Check for mistakes.
Comment on lines +152 to +153
The **JSON type** has a size limit of **65,535 items** per object or array — this corresponds to the maximum value of a 16-bit unsigned integer.
If you attempt to cast text into the JSON type and it contains more than 65,535 elements, the following error will be thrown:
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

The term 'JSON type' should be consistently formatted as 'json' (lowercase, in code style) to match the formatting used elsewhere in the document when referring to the data type itself.

Suggested change
The **JSON type** has a size limit of **65,535 items** per object or array — this corresponds to the maximum value of a 16-bit unsigned integer.
If you attempt to cast text into the JSON type and it contains more than 65,535 elements, the following error will be thrown:
The **json** data type has a size limit of **65,535 items** per object or array — this corresponds to the maximum value of a 16-bit unsigned integer.
If you attempt to cast text into the **json** data type and it contains more than 65,535 elements, the following error will be thrown:

Copilot uses AI. Check for mistakes.
@WilliamDAssafMSFT
Copy link
Contributor

Thanks @bpp-incom for contacting Microsoft with a contribution to our product documentation. I've reached out to the product group to confirm. It could take from a few business days to a few weeks to confirm your change internally. We'll contact you if we need further information, and you'll receive an email message each time we "@mention" you in a comment.

By opening a pull request, you're helping the authors add your approved change directly to the documentation. If the article is updated with your commit, GitHub will list you as an article contributor.

Thanks again for this feedback. Your suggestions help improve our documentation.

@WilliamDAssafMSFT
Copy link
Contributor

Thanks @bpp-incom for taking the time to submit this PR! Good catch. This article update is in flight. After the updated article is published, GitHub will list you as a commit co-author.

Thanks again for this feedback, your suggestions help improve our documentation.

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

Labels

aq-pr-triaged tracking label for the PR review team do-not-merge review-team-triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants