nightmaregaurav.systemtextjsonhelper
1.0.1
See the version list below for details.
dotnet add package nightmaregaurav.systemtextjsonhelper --version 1.0.1
NuGet\Install-Package nightmaregaurav.systemtextjsonhelper -Version 1.0.1
<PackageReference Include="nightmaregaurav.systemtextjsonhelper" Version="1.0.1" />
paket add nightmaregaurav.systemtextjsonhelper --version 1.0.1
#r "nuget: nightmaregaurav.systemtextjsonhelper, 1.0.1"
// Install nightmaregaurav.systemtextjsonhelper as a Cake Addin #addin nuget:?package=nightmaregaurav.systemtextjsonhelper&version=1.0.1 // Install nightmaregaurav.systemtextjsonhelper as a Cake Tool #tool nuget:?package=nightmaregaurav.systemtextjsonhelper&version=1.0.1
SystemTextJsonHelper
SystemTextJsonHelper
is a C# helper class lib that simplifies the process of serializing and deserializing objects using the System.Text.Json
namespace. It provides a flexible and convenient way to handle JSON serialization and deserialization with customizable options.
Features
- Serialize objects to JSON strings with customizable options.
- Deserialize JSON strings back into objects with customizable options.
- Easily set global serialization options for consistent behavior across the application.
Usage
To use the SystemTextJsonHelper
in your project, follow these steps:
- Install the package from NuGet.
- import the
SystemTextJsonHelper
namespace. - Configure global options using
SetGlobalJsonSerializerOptions
method ofJsonHelper
class. - You can get current options using
GetJsonSerializerOptions
orGetJsonSerializerOptions
to get default options. - Access static methods
Serialize
orDeserialize
from theJsonHelper
class for serialization and deserialization.
Serialization
var myObject = new MyCustomObject();
string json = JsonHelper.Serialize(myObject);
// With custom options:
string customJson = JsonHelper.Serialize(myObject, options => {
// Customize the JsonSerializerOptions here
options.IncludeFields = true;
return options;
});
Deserialization
string jsonString = "{\"propertyName\": \"propertyValue\"}";
MyCustomObject deserializedObject = JsonHelper.Deserialize<MyCustomObject>(jsonString);
// With custom options:
MyCustomObject customDeserializedObject = JsonHelper.Deserialize<MyCustomObject>(jsonString, options => {
// Customize the JsonSerializerOptions here
options.PropertyNameCaseInsensitive = true;
return options;
});
License
SystemTextJsonHelper
is released under the MIT License. You can find the full license details in the LICENSE file.
Made with ❤️ by NightmareGaurav.
Open For Contribution
We welcome contributions from the community. If you have suggestions, bug reports, or feature requests, please feel free to open issues or pull requests on GitHub.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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. |
-
net7.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on nightmaregaurav.systemtextjsonhelper:
Package | Downloads |
---|---|
nightmaregaurav.rediscachehelper
A C# utility library that provides caching functionality using the StackExchange.Redis library without DI. It simplifies the process of storing and retrieving data from a Redis cache, allowing for efficient and reliable caching of objects. |
GitHub repositories
This package is not used by any popular GitHub repositories.