Breaking Change T1246468
Visible to All Users

System.Text.Json is now used to process JsonDataSource (DashboardJsonDataSource) for .NET Framework-based projects

What Changed

System.Text.Json is now used to process JsonDataSource (DashboardJsonDataSource) for .NET Framework-based projects.

Reasons for Change

  • Microsoft designed System.Text.Json for security compliance ( RFC 8259 specification) and optimal performance (faster and lower memory allocation).
  • Microsoft uses System.Text.Json in many of its products (since the release of ASP.NET Core 3.0). Microsoft also recommends it as a long-term solution for .NET developers. For more information, refer to Overview | Migrate from Newtonsoft.Json to System.Text.Json.
  • Microsoft supports System.Text.Json for .NET 6+ and .NET Framework 4.6.2+ based apps. This support allows us to use this library across a broad range of DevExpress libraries/components.

Impact on Existing Apps

Json data source will throw an exception during deserialization in the following instances:

  • Json structure does not meet the ECMA-262 standard. For example, Json property names must be enclosed in double quotes. Single quotes or no quotes are not allowed.
  • Date-time format does not meet the ISO 8601-1:2019 standard. See: DateTime and DateTimeOffset support in System.Text.Json.
  • An exception occurs when defining a JsonDataSource (DashboardJsonDataSource) schema. For example, if field type is defined as Int64 (long) and the field contains fractional values, an exception will be thrown and System.Text.Json will indicate that the value cannot be converted to Int64.

How to Update Existing Apps

  • Ensure source Json files meet appropriate requirements (update date-time format and quotes for Json properties).
  • Use the JsonDataSource.SchemaDiscoveryMaxItemCount property to extend the number of elements to analyze at each level to build the schema. Once complete, update the resulting JsonDataSource (DashboardJsonDataSource) schema in the Data Source Wizard.

How to Revert to Previous Behavior

Set the DevExpress.DataAccess.Native.Json.JsonLoaderHelper.ProcessingLibrary property to NewtonsoftJson:

C#
DevExpress.DataAccess.Native.Json.JsonLoaderHelper.ProcessingLibrary = DevExpress.DataAccess.Native.Json.JsonLoaderHelper.JsonProcessingLibrary.NewtonsoftJson

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.