PdfPrep.com

Which code should you insert at line 03?

You are creating a console application named Appl.

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 . Option A
B . Option B
C . Option C
D . Option D

Answer: B

Explanation:

JavaScriptSerializer().Deserialize

Converts the specified JSON string to an object of type T.

Example:

string json = File.ReadAllText(Environment.CurrentDirectory + @"JSON.txt");

Company company = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<Company>(

Reference: C# – serialize object to JSON format using JavaScriptSerializer

http://matijabozicevic.com/blog/csharp-net-development/csharp-serialize-object-to-json-format-using-javascriptserialization

Exit mobile version