ktsu.ToStringJsonConverter
1.0.25
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package ktsu.ToStringJsonConverter --version 1.0.25
NuGet\Install-Package ktsu.ToStringJsonConverter -Version 1.0.25
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="ktsu.ToStringJsonConverter" Version="1.0.25" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ktsu.ToStringJsonConverter --version 1.0.25
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ktsu.ToStringJsonConverter, 1.0.25"
#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 ktsu.ToStringJsonConverter as a Cake Addin #addin nuget:?package=ktsu.ToStringJsonConverter&version=1.0.25 // Install ktsu.ToStringJsonConverter as a Cake Tool #tool nuget:?package=ktsu.ToStringJsonConverter&version=1.0.25
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ktsu.ToStringJsonConverter
Overview
ToStringJsonConverter
is a JSON converter factory that simplifies serialization and deserialization of custom types in .NET by leveraging the ToString
and FromString
methods.
Features
- Automatically identifies types with a
FromString
method for custom serialization. - Converts objects to and from JSON using their string representation.
- Supports custom types with static
FromString
methods.
Installation
Install via NuGet:
dotnet add package ktsu.ToStringJsonConverter
Usage
Configure the converter in your JsonSerializerOptions
:
var options = new JsonSerializerOptions();
options.Converters.Add(new ToStringJsonConverterFactory());
Example
public class MyType
{
public string Value { get; set; }
public static MyType FromString(string value) => new() { Value = value };
public override string ToString() => Value;
}
var myType = new MyType { Value = "example" };
string json = JsonSerializer.Serialize(myType, options); // "example"
MyType deserialized = JsonSerializer.Deserialize<MyType>(json, options);
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Product | Versions 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.
-
net8.0
- ktsu.Extensions (>= 1.0.30)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on ktsu.ToStringJsonConverter:
Package | Downloads |
---|---|
ktsu.AppDataStorage
Application data management library using JSON serialization to save and load data in the user's app data folder. |
|
ktsu.Schema
Schema |
|
ktsu.PkmnDB
PkmnDB |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.1-pre.1 | 52 | 16 days ago |
1.1.0 | 276 | 17 days ago |
1.0.49-pre.3 | 55 | a month ago |
1.0.49-pre.2 | 50 | a month ago |
1.0.49-pre.1 | 46 | a month ago |
1.0.48 | 1,971 | 2 months ago |
1.0.48-pre.30 | 50 | a month ago |
1.0.48-pre.29 | 47 | a month ago |
1.0.48-pre.28 | 52 | a month ago |
1.0.48-pre.27 | 49 | a month ago |
1.0.48-pre.26 | 45 | a month ago |
1.0.48-pre.25 | 47 | a month ago |
1.0.48-pre.24 | 42 | a month ago |
1.0.48-pre.23 | 49 | a month ago |
1.0.48-pre.22 | 44 | a month ago |
1.0.48-pre.21 | 40 | 2 months ago |
1.0.48-pre.20 | 42 | 2 months ago |
1.0.48-pre.19 | 27 | 2 months ago |
1.0.48-pre.18 | 41 | 2 months ago |
1.0.48-pre.17 | 47 | 2 months ago |
1.0.48-pre.16 | 37 | 2 months ago |
1.0.48-pre.15 | 44 | 2 months ago |
1.0.48-pre.14 | 35 | 2 months ago |
1.0.48-pre.13 | 52 | 2 months ago |
1.0.48-pre.12 | 53 | 2 months ago |
1.0.48-pre.11 | 73 | 2 months ago |
1.0.48-pre.10 | 56 | 2 months ago |
1.0.48-pre.9 | 55 | 2 months ago |
1.0.48-pre.8 | 54 | 2 months ago |
1.0.48-pre.7 | 54 | 2 months ago |
1.0.48-pre.6 | 74 | 2 months ago |
1.0.48-pre.5 | 52 | 2 months ago |
1.0.48-pre.4 | 57 | 2 months ago |
1.0.48-pre.3 | 47 | 2 months ago |
1.0.48-pre.2 | 49 | 2 months ago |
1.0.48-pre.1 | 50 | 2 months ago |
1.0.47-pre.1 | 46 | 2 months ago |
1.0.46 | 271 | 2 months ago |
1.0.45 | 86 | 2 months ago |
1.0.44 | 83 | 2 months ago |
1.0.43 | 83 | 2 months ago |
1.0.42 | 88 | 2 months ago |
1.0.41 | 101 | 2 months ago |
1.0.40 | 86 | 2 months ago |
1.0.39 | 94 | 2 months ago |
1.0.38 | 244 | 2 months ago |
1.0.37 | 252 | 2 months ago |
1.0.36 | 85 | 2 months ago |
1.0.35 | 105 | 2 months ago |
1.0.34 | 304 | 3 months ago |
1.0.33 | 234 | 3 months ago |
1.0.32 | 326 | 3 months ago |
1.0.31 | 255 | 3 months ago |
1.0.30 | 137 | 3 months ago |
1.0.29 | 237 | 3 months ago |
1.0.28 | 104 | 3 months ago |
1.0.27 | 122 | 3 months ago |
1.0.26 | 164 | 3 months ago |
1.0.25 | 165 | 3 months ago |
1.0.24 | 136 | 3 months ago |
1.0.23 | 98 | 3 months ago |
1.0.22 | 188 | 3 months ago |
1.0.21 | 160 | 3 months ago |
1.0.20 | 174 | 3 months ago |
1.0.19 | 295 | 4 months ago |
1.0.18 | 169 | 4 months ago |
1.0.17 | 149 | 4 months ago |
1.0.16 | 401 | 4 months ago |
1.0.15 | 158 | 4 months ago |
1.0.14 | 576 | 5 months ago |
1.0.13 | 383 | 5 months ago |
1.0.12 | 134 | 5 months ago |
1.0.11 | 303 | 5 months ago |
1.0.10 | 129 | 5 months ago |
1.0.10-pre.1 | 47 | 2 months ago |
1.0.9 | 143 | 6 months ago |
1.0.8 | 142 | 6 months ago |
1.0.7 | 94 | 6 months ago |
1.0.6 | 127 | 6 months ago |
1.0.5 | 101 | 6 months ago |
1.0.4 | 102 | 6 months ago |
1.0.3 | 218 | 6 months ago |
1.0.2 | 143 | 6 months ago |
1.0.1 | 209 | 6 months ago |
1.0.0 | 110 | 6 months ago |