Microsoft Fabric Updates Blog

JSON aggregates in Fabric Datawarehouse (Preview)

The preview for JSON aggregate functions in Fabric Datawarehouse has begun. You can now take advantage of two powerful JSON aggregate functions during this preview period.

  • JSON_ARRAYAGG: Constructs a JSON array from an aggregation of SQL data or columns. It can be used to create a JSON array from a set of values.
  • JSON_OBJECTAGG: Constructs a JSON object from an aggregation of SQL data or columns. It allows you to create key-value pairs from your data.

The preview for these two aggregate functions is already live in Azure SQL Database, and we are excited to announce that it is now also available in Fabric Data Warehouse.

JSON_ARRAYAGG

JSON_ARRAYAGG is an aggregate function that formats a set of cells within a group into a JSON array. For example, if we select country, state, and county from the geography table, we can observe different values of county within each (country, state) group.

There is a set of cells in each group

If we group rows by country and state, we can concatenate all county cells within each group and output them as a single JSON array per group.

The repeated cells within the groups are returned as JSON arrays

The JSON_ARRAYAGG function is especially useful when you need to represent a set of values as an array, especially when you need to join parent/child rows and return a list of child values for each parent row.

JSON_OBJECTAGG

JSON_OBJECTAGG is an aggregate function that takes two columns within a group of rows and formats their cells as key-value pairs in a single JSON object for each group.

For example, imagine we have a T-SQL query that returns average temperatures in Fahrenheit for cities defined by zip codes during the period from October 14, 2010, to October 21, 2020.

Within each group we see DateId and Farenheit values

We can observe that within each group of rows, only DateID and AvgTemperatureFahrenheit differ.

By grouping the rows within the same city/county partition, we can obtain the (DateID, AvgTemperatureFahrenheit) pairs and format them as a JSON object. The JSON_OBJECTAGG function allows you to pivot multiple rows and represent pairs of columns as key-value pairs in the aggregated JSON object.

Date and temperatures are aggregated as key:value properties of the JSON objects

The JSON_OBJECTAGG function is incredibly useful when you need to pivot values from multiple rows within a group into the properties of a single JSON object associated with that group.

Conclusion

JSON_ARRAYAGG and JSON_OBJECTAGG are significant enhancements in T-SQL language that simplify the complex formatting of JSON objects in queries. Tasks that previously required inline FOR JSON expressions or a combination of STRING_AGG and STRING_ESCAPE functions can now be accomplished more easily.

These two aggregate functions are currently in preview in both Azure SQL Database and Fabric Data Warehouse, and they will become generally available simultaneously.

相關部落格文章

JSON aggregates in Fabric Datawarehouse (Preview)

11月 5, 2025 作者: Pradeep Srikakolapu

In our earlier announcement, we shared that newly created data warehouses, lakehouses and other items in Microsoft Fabric would no longer automatically generate default semantic models. This change allows customers to have more control over their modeling experience and to explicitly choose when and how to create semantic models. Starting end of October 2025, Microsoft … Continue reading “Decoupling Default Semantic Models for Existing Items in Microsoft Fabric”

11月 3, 2025 作者: Jovan Popovic

Data ingestion is one of the most important actions in the Data Warehouse solutions. In Microsoft Fabric Data Warehouse, the OPENROWSET function provides a powerful and flexible way to read data from files stored in Fabric OneLake or external Azure Storage accounts. Whether you’re working with Parquet, CSV, TSV, or JSONL files, the OPENROWSET function … Continue reading “Ingest files into your Fabric Data Warehouse using the OPENROWSET function”