Home  >  Article  >  Backend Development  >  Detailed introduction to DataContractJsonSerializer

Detailed introduction to DataContractJsonSerializer

零下一度
零下一度Original
2017-06-14 09:45:262767browse

You can use the DataContractJsonSerializer class to serialize type instances into JSON strings and deserialize JSON strings into type instances. DataContractJsonSerializer is under the System.Runtime.Serialization.Json namespace. .NET Framework 3.5 is included in System.ServiceModel.Web.dll, and a reference to it needs to be added; .NET Framework 4 is in System.Runtime.Serialization. Code for serialization and deserialization using DataContractJsonSerializer: 1: using System; 2: using System.Collections.Generic; 3: using System.Linq;

1. Analysis of serialization and deserialization operations of JSON data in .NET

Detailed introduction to DataContractJsonSerializer

Introduction: You can use the DataContractJsonSerializer class to serialize type instances to JSON strings and deserialize JSON strings to type instances. DataContractJsonSerializer is under the System.Runtime.Serialization.Json namespace. .NET Framework 3.5 is included in System.ServiceModel.Web.dll and a reference to it needs to be added; .NET F

##2 . .Net——Use DataContractJsonSerializer for basic serialization and deserialization operations

Detailed introduction to DataContractJsonSerializer

Introduction : In daily life, we often use the process of serializing a T type thing into Json and then returning the bound data to the page. In every interview, I am probably asked how to serialize? The answer is always encapsulated at the bottom level, forget it, let’s make a simple chestnut for fun, so as to block the interviewer’s mouth. When serializing and deserializing, the object DataContractJsonSerializer is mainly used, and then combined with MemoryStream, it is ok. Without further ado, let’s start with a simple version

The above is the detailed content of Detailed introduction to DataContractJsonSerializer. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn