Skip to content

🐞 Bug Report: SSMS 22 Preview – Large JSON Output Split Across Multiple Rows #26448

@Harsh-2402

Description

@Harsh-2402

Title:
Large JSON output from FOR JSON PATH automatically splits into multiple rows in SSMS 22 Preview


Product and Version

  • Product: SQL Server Management Studio (SSMS)
  • Version: SSMS 22 Preview (latest build as of October 2025)
  • SQL Server Engine Version: SQL Server 2019 / 2022 (tested on both)
  • Operating System: Windows 10 / Windows 11

Issue Description

When executing a query that generates a large JSON result using FOR JSON PATH, SSMS 22 Preview splits the JSON output into multiple rows in the Results (Messages) grid.

In previous SSMS versions (e.g., SSMS 18.x / 19.x), the entire JSON output appeared as a single cell or line, properly formatted as one continuous JSON string.

This behavior causes issues when copying or exporting JSON output because it is truncated or fragmented across multiple rows, making it invalid JSON unless manually reconstructed.


Steps to Reproduce

  1. Run the following script in SSMS 22 Preview:

    IF OBJECT_ID('tempdb..#UserList') IS NOT NULL
        DROP TABLE #UserList;
    
    CREATE TABLE #UserList (
        user_code INT,
        user_name NVARCHAR(100),
        user_email NVARCHAR(100)
    );
    
    ;WITH Numbers AS (
        SELECT TOP (20000)
            ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS num
        FROM sys.objects a
        CROSS JOIN sys.objects b
    )
    INSERT INTO #UserList (user_code, user_name, user_email)
    SELECT 
        num,
        CONCAT('User_', num),
        CASE WHEN num % 5 = 0 THEN NULL 
             ELSE CONCAT('user', num, '@example.com') END
    FROM Numbers;
    
    SELECT  
        ROW_NUMBER() OVER (ORDER BY user_code) AS row_num,
        user_code,
        user_name,
        user_email
    FROM #UserList
    ORDER BY user_code
    FOR JSON PATH, INCLUDE_NULL_VALUES;
  2. Observe the result in the Results > Messages pane.


Expected Behavior

  • The JSON output should appear as a single line or a single cell containing the entire JSON array, similar to behavior in SSMS 18.x / 19.x.
  • The JSON should be valid, continuous, and ready to copy/export.

Actual Behavior

  • In SSMS 22 Preview, the JSON output is split into multiple rows.
  • Each row contains a fragment of the overall JSON text (for example, first 2033 characters per row).
  • When copying results, JSON becomes invalid/incomplete unless manually concatenated.

Impact

  • Makes it difficult to export or validate large JSON results.
  • Breaks automation workflows that rely on copying query results directly from SSMS.
  • Causes confusion for developers comparing results between SSMS 18/19 and SSMS 22 Preview.

Workarounds

  1. Use:

    DECLARE @json NVARCHAR(MAX);
    SELECT @json = (
        SELECT ... FOR JSON PATH, INCLUDE_NULL_VALUES
    );
    SELECT @json;

    This returns JSON as one continuous NVARCHAR output.

  2. Use older SSMS versions (18 or 19) where this issue doesn’t occur.


Screenshot

SSMS 22 Preview

Image

SSMS older SSMS versions (18 or 19)

Image

Additional Notes

  • The issue appears to be related to SSMS result buffer limits or automatic output chunking introduced in SSMS 22 Preview.
  • It is not related to SQL Server Engine, as the same query in other clients (Azure Data Studio, SSMS 19.x) returns continuous JSON.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions