JSON Serialization

The .NET languages support the JavaScript Object Notation (JSON) serialization, offered by the System.Runtime.Serialization.Json namespace. It is particularly useful when you need to serialize objects as JavaScript-compliant and is used in WCF and ASP.NET Ajax applications. Conceptually, JSON serialization works like the WCF serialization illustrated previously. The only difference is that you use a DataContractJSonSerializer class that works as in the following code snippet:

Dim target As New FileStream("C:\Temp\WcfSerialized.xml", FileMode.Create)Dim jsonSerializer As New DataContractJsonSerializer(GetType(Person))jsonSerializer.WriteObject(target, p)

To deserialize objects, you invoke the

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.