Skip to content

Commit 120ac05

Browse files
authored
Change Json.NET to System.Text.Json (#3758)
1 parent a2982c8 commit 120ac05

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

xml/System.Web.Script.Serialization/JavaScriptSerializer.xml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,19 @@
1616
<Interfaces />
1717
<Docs>
1818
<summary>
19-
<see href="https://www.newtonsoft.com/json">Json.NET</see> should be used for serialization and deserialization. Provides serialization and deserialization functionality for AJAX-enabled applications.</summary>
19+
For .NET Framework 4.7.2 and later versions, use the APIs in the <see cref="N:System.Text.Json" /> namespace for serialization and deserialization. For earlier versions of .NET Framework, use <see href="https://www.newtonsoft.com/json">Newtonsoft.Json</see>. This type was intended to provide serialization and deserialization functionality for AJAX-enabled applications.
20+
</summary>
2021
<remarks>
2122
<format type="text/markdown"><![CDATA[
2223
2324
## Remarks
24-
The <xref:System.Web.Script.Serialization.JavaScriptSerializer> class is used internally by the asynchronous communication layer to serialize and deserialize the data that is passed between the browser and the Web server. You cannot access that instance of the serializer. However, this class exposes a public API. Therefore, you can use the class when you want to work with JavaScript Object Notation (JSON) in managed code.
25+
26+
> [!IMPORTANT]
27+
> For .NET Framework 4.7.2 and later versions, the APIs in the <xref:System.Text.Json> namespace should be used for serialization and deserialization. For earlier versions of .NET Framework, use [Newtonsoft.Json](https://www.newtonsoft.com/json).
28+
29+
The <xref:System.Web.Script.Serialization.JavaScriptSerializer> class is used internally by the asynchronous communication layer to serialize and deserialize the data that is passed between the browser and the Web server. You cannot access that instance of the serializer. However, this class exposes a public API. Therefore, you can use the class when you want to work with JavaScript Object Notation (JSON) in managed code.
2530
26-
To serialize an object, use the <xref:System.Web.Script.Serialization.JavaScriptSerializer.Serialize%2A> method. To deserialize a JSON string, use the <xref:System.Web.Script.Serialization.JavaScriptSerializer.Deserialize%2A> or <xref:System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObject%2A> methods. To serialize and deserialize types that are not natively supported by <xref:System.Web.Script.Serialization.JavaScriptSerializer>, implement custom converters by using the <xref:System.Web.Script.Serialization.JavaScriptConverter> class. Then register the converters by using the <xref:System.Web.Script.Serialization.JavaScriptSerializer.RegisterConverters%2A> method.
31+
To serialize an object, use the <xref:System.Web.Script.Serialization.JavaScriptSerializer.Serialize%2A> method. To deserialize a JSON string, use the <xref:System.Web.Script.Serialization.JavaScriptSerializer.Deserialize%2A> or <xref:System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObject%2A> methods. To serialize and deserialize types that are not natively supported by <xref:System.Web.Script.Serialization.JavaScriptSerializer>, implement custom converters by using the <xref:System.Web.Script.Serialization.JavaScriptConverter> class. Then register the converters by using the <xref:System.Web.Script.Serialization.JavaScriptSerializer.RegisterConverters%2A> method.
2732
2833
## Mapping Between Managed Types and JSON
2934
The following table shows the mapping between managed types and JSON for the serialization process. These managed types are natively supported by <xref:System.Web.Script.Serialization.JavaScriptSerializer>. When you are deserializing from a JSON string to a managed type, the same mapping applies. However, deserialization can be asymmetric; not all serializable managed types can be deserialized from JSON.

0 commit comments

Comments
 (0)