You are creating a console application named App1.
App1 retrieves data from the Internet by using JavaScript Object Notation (JSON).
You are developing the following code segment (line numbers are included for reference only):
You need to ensure that the code validates the JSON string.
Which code should you insert at line 03?
A.
DataContractSerializer serializer = new DataContractSerializer();
B.
var serializer = new DataContractSerializer();
C.
XmlSerlalizer serializer = new XmlSerlalizer();
D.
var serializer = new JavaScriptSerializer();
Explanation:
The JavaScriptSerializer Class Provides serialization and deserialization functionality for AJAX- enabled
applications.
The 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.