SingularFrameworkCore.Serialization.Newtonsoft.Json 0.2.0-beta

This is a prerelease version of SingularFrameworkCore.Serialization.Newtonsoft.Json.
dotnet add package SingularFrameworkCore.Serialization.Newtonsoft.Json --version 0.2.0-beta                
NuGet\Install-Package SingularFrameworkCore.Serialization.Newtonsoft.Json -Version 0.2.0-beta                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SingularFrameworkCore.Serialization.Newtonsoft.Json" Version="0.2.0-beta" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SingularFrameworkCore.Serialization.Newtonsoft.Json --version 0.2.0-beta                
#r "nuget: SingularFrameworkCore.Serialization.Newtonsoft.Json, 0.2.0-beta"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SingularFrameworkCore.Serialization.Newtonsoft.Json as a Cake Addin
#addin nuget:?package=SingularFrameworkCore.Serialization.Newtonsoft.Json&version=0.2.0-beta&prerelease

// Install SingularFrameworkCore.Serialization.Newtonsoft.Json as a Cake Tool
#tool nuget:?package=SingularFrameworkCore.Serialization.Newtonsoft.Json&version=0.2.0-beta&prerelease                

SingularFrameworkCore.Serialization.Newtonsoft.Json

A C# library that provides a JSON serializer implementation for the SingularFrameworkCore serialization interface. This library leverages the popular Newtonsoft.Json library to offer robust serialization and deserialization capabilities.

Features

  • Generic Input Type: Supports serialization and deserialization of any object type.
  • Newtonsoft.Json: Utilizes the widely-used Newtonsoft.Json library for JSON operations.
  • Bidirectional Support: Implements both serialization and deserialization.

Installation

The package is available on NuGet. To install it, use the following command:

Install-Package SingularFrameworkCore.Serialization.Newtonsoft.Json

Or using the .NET CLI:

dotnet add package SingularFrameworkCore.Serialization.Newtonsoft.Json

Usage

Serialization and Deserialization

using SingularFrameworkCore.Serialization.Newtonsoft.Json;

// Declare our example model
class MyClass {
    public string Name;
    public int Age;
}

// Create an instance of the JsonSerializer for your specific type
var jsonSerializer = new JsonSerializer<MyClass>();

// Create an object to serialize
var myObject = new MyClass { Name = "John", Age = 30 };

// Serialize the object to a JSON string
string jsonString = jsonSerializer.Serialize(myObject);

// Deserialize the JSON string back to an object
MyClass deserializedObject = jsonSerializer.Deserialize(jsonString);

Integration with SingularFrameworkCore

This library implements the IEntitySerializer<I, O> interface from SingularFrameworkCore, making it ideal for use within the Singular pipeline:

var singular = new Singular<MyClass, string>(
    repository,
    new JsonSerializer<MyClass>(), // Use the JSON serializer
    preProcessors,
    postProcessors
);

Requirements

  • .NET Standard 8.0+
  • Newtonsoft.Json

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Author

Created by Mohammad Ayaad

Product Compatible and additional computed target framework versions.
.NET 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.0-beta 35 2/18/2025
0.1.0-alpha 36 1/30/2025