SerializationHelper 2.0.1
dotnet add package SerializationHelper --version 2.0.1
NuGet\Install-Package SerializationHelper -Version 2.0.1
<PackageReference Include="SerializationHelper" Version="2.0.1" />
paket add SerializationHelper --version 2.0.1
#r "nuget: SerializationHelper, 2.0.1"
// Install SerializationHelper as a Cake Addin #addin nuget:?package=SerializationHelper&version=2.0.1 // Install SerializationHelper as a Cake Tool #tool nuget:?package=SerializationHelper&version=2.0.1
<img src="https://github.com/jchristn/SerializationHelper/blob/main/Assets/logo.png?raw=true" data-canonical-src="https://github.com/jchristn/SerializationHelper/blob/main/Assets/logo.png?raw=true" width="128" height="128" />
SerializationHelper
SerializationHelper is a simple wrapper around System.Text.Json
to overcome some of the common challenges developers face when using Microsoft's JSON library.
Help, Feedback, Contribute
If you have any issues or feedback, please file an issue here in Github. We'd love to have you help by contributing code for new features, optimization to the existing codebase, ideas for future releases, or fixes!
Overview
This project was built to provide a simple interface over System.Text.Json
. Let's face it. Migrating from the wonderful Newtonsoft.Json
package wasn't as easy as anyone expected. Microsoft's implementation is strong but has strong opinions and doesn't, as of the creation of this library, provide the same level of out-of-the-box experience as the Newtonsoft implementation.
This library is my attempt at trying to make the Microsoft implementation behave in a manner consistent to what I experienced while using the Newtonsoft implementation.
New in v2.0.x
v2.0.x
- Migrate from a static class
- Allow users to add their own default
JsonSerializerOptions
- Allow users to add and manage their own default list of
JsonConverter
objects
Example Project
Refer to the Test
project for exercising the library.
using SerializationHelper;
public class Person
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
Serializer serializer = new Serializer();
Person p1 = new Person { Id = 10, FirstName = "Joe", LastName = "Smith" };
Console.WriteLine(serializer.SerializeJson(p1, false)); // false = not pretty print
// {"Id":10,"FirstName":"Joe","LastName":"Smith"}
Person p2 = serializer.DeserializeJson<Person>("{\"Id\":10,\"FirstName\":\"Joe\",\"LastName\":\"Smith\"}");
Console.WriteLine(p2.Id + ": " + p2.FirstName + " " + p2.LastName);
// 10: Joe Smith
Add Your Own JsonConverter
using SerializationHelper;
public class MyClassConverter : JsonConverter<MyClass>
{
...
}
Serializer serializer = new Serializer();
serializer.DefaultConverters.Add(new MyClassConverter());
Version History
Refer to CHANGELOG.md for version history.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
-
.NETFramework 4.6.2
- System.Text.Json (>= 8.0.5)
-
.NETFramework 4.8
- System.Text.Json (>= 8.0.5)
-
net6.0
- System.Text.Json (>= 8.0.5)
-
net7.0
- System.Text.Json (>= 8.0.5)
-
net8.0
- System.Text.Json (>= 8.0.5)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on SerializationHelper:
Package | Downloads |
---|---|
PDictionary
PDictionary is a persistent dictionary that stores dictionary contents to a JSON file. |
|
PaigoDotNet
Simple C# library for using Paigo. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release