Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

JSON Serialization and Deserialization - C#

RSS
Modified on Fri, Mar 11, 2022, 7:19 AM by Administrator Categorized as ┬ĚNet Core

Overview

This article documents notes about serializing and deserializing object to and from JSON.

Prerequisites

  • Install the "System.Text.Json" NuGet package

Code

using System.Text.Json;

/* Serialize */
var json = JsonSerializer.Serialize(myObject);

/* Deserialize */
var myObject = JsonSerializer.Deserialize<MyClass>(json)

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2022, Patrick Jasinski.