ktsu.ToStringJsonConverter
1.0.21
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.21
NuGet\Install-Package ktsu.ToStringJsonConverter -Version 1.0.21
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.21" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ktsu.ToStringJsonConverter" Version="1.0.21" />
<PackageReference Include="ktsu.ToStringJsonConverter" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ktsu.ToStringJsonConverter --version 1.0.21
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ktsu.ToStringJsonConverter, 1.0.21"
#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.
#:package ktsu.ToStringJsonConverter@1.0.21
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ktsu.ToStringJsonConverter&version=1.0.21
#tool nuget:?package=ktsu.ToStringJsonConverter&version=1.0.21
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ktsu.io.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
FromStringmethod for custom serialization. - Converts objects to and from JSON using their string representation.
- Supports custom types with static
FromStringmethods.
Installation
Install via NuGet:
dotnet add package ktsu.io.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 | 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. 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- ktsu.Extensions (>= 1.0.25)
-
net8.0
- ktsu.Extensions (>= 1.0.25)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ktsu.ToStringJsonConverter:
| Package | Downloads |
|---|---|
|
ktsu.Schema
Schema |
|
|
ktsu.PkmnDB
PkmnDB |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 1.2.4 | 444 | 5/21/2025 | |
| 1.2.4-pre.17 | 151 | 5/20/2025 | |
| 1.2.4-pre.15 | 110 | 5/17/2025 | |
| 1.2.4-pre.14 | 171 | 5/16/2025 | |
| 1.2.4-pre.13 | 251 | 5/15/2025 | |
| 1.2.4-pre.12 | 238 | 5/14/2025 | |
| 1.2.4-pre.11 | 243 | 5/13/2025 | |
| 1.2.4-pre.10 | 272 | 5/12/2025 | |
| 1.2.4-pre.9 | 200 | 5/11/2025 | |
| 1.2.4-pre.8 | 140 | 5/10/2025 | |
| 1.2.4-pre.7 | 85 | 5/9/2025 | |
| 1.2.4-pre.6 | 158 | 5/8/2025 | |
| 1.2.4-pre.5 | 163 | 5/7/2025 | |
| 1.2.4-pre.4 | 163 | 5/6/2025 | |
| 1.2.4-pre.3 | 145 | 5/5/2025 | |
| 1.2.4-pre.2 | 164 | 5/4/2025 | |
| 1.2.4-pre.1 | 146 | 5/4/2025 | |
| 1.2.3 | 3,356 | 5/4/2025 | |
| 1.2.3-pre.1 | 85 | 4/26/2025 | |
| 1.2.2 | 682 | 4/25/2025 | |
| 1.2.2-pre.1 | 161 | 4/4/2025 | |
| 1.2.1 | 781 | 3/30/2025 | |
| 1.2.0 | 439 | 3/30/2025 | |
| 1.1.1-pre.3 | 120 | 3/29/2025 | |
| 1.1.1-pre.2 | 500 | 3/25/2025 | |
| 1.1.1-pre.1 | 110 | 2/18/2025 | |
| 1.1.0 | 1,258 | 2/17/2025 | |
| 1.0.49-pre.3 | 120 | 2/6/2025 | |
| 1.0.49-pre.2 | 96 | 2/5/2025 | |
| 1.0.49-pre.1 | 98 | 2/5/2025 | |
| 1.0.48 | 2,640 | 12/27/2024 | |
| 1.0.48-pre.30 | 103 | 2/4/2025 | |
| 1.0.48-pre.29 | 101 | 2/3/2025 | |
| 1.0.48-pre.28 | 114 | 2/1/2025 | |
| 1.0.48-pre.27 | 103 | 1/30/2025 | |
| 1.0.48-pre.26 | 100 | 1/28/2025 | |
| 1.0.48-pre.25 | 96 | 1/26/2025 | |
| 1.0.48-pre.24 | 95 | 1/24/2025 | |
| 1.0.48-pre.23 | 101 | 1/22/2025 | |
| 1.0.48-pre.22 | 96 | 1/20/2025 | |
| 1.0.48-pre.21 | 98 | 1/18/2025 | |
| 1.0.48-pre.20 | 87 | 1/16/2025 | |
| 1.0.48-pre.19 | 86 | 1/14/2025 | |
| 1.0.48-pre.18 | 93 | 1/13/2025 | |
| 1.0.48-pre.17 | 95 | 1/11/2025 | |
| 1.0.48-pre.16 | 101 | 1/10/2025 | |
| 1.0.48-pre.15 | 93 | 1/10/2025 | |
| 1.0.48-pre.14 | 85 | 1/8/2025 | |
| 1.0.48-pre.13 | 104 | 1/7/2025 | |
| 1.0.48-pre.12 | 113 | 1/5/2025 | |
| 1.0.48-pre.11 | 131 | 1/3/2025 | |
| 1.0.48-pre.10 | 97 | 1/3/2025 | |
| 1.0.48-pre.9 | 96 | 1/3/2025 | |
| 1.0.48-pre.8 | 115 | 1/3/2025 | |
| 1.0.48-pre.7 | 87 | 1/2/2025 | |
| 1.0.48-pre.6 | 128 | 12/31/2024 | |
| 1.0.48-pre.5 | 103 | 12/30/2024 | |
| 1.0.48-pre.4 | 107 | 12/29/2024 | |
| 1.0.48-pre.3 | 98 | 12/28/2024 | |
| 1.0.48-pre.2 | 95 | 12/27/2024 | |
| 1.0.48-pre.1 | 99 | 12/27/2024 | |
| 1.0.47-pre.1 | 100 | 12/27/2024 | |
| 1.0.46 | 366 | 12/26/2024 | |
| 1.0.45 | 153 | 12/26/2024 | |
| 1.0.44 | 134 | 12/26/2024 | |
| 1.0.43 | 132 | 12/26/2024 | |
| 1.0.42 | 142 | 12/26/2024 | |
| 1.0.41 | 165 | 12/26/2024 | |
| 1.0.40 | 111 | 12/26/2024 | |
| 1.0.39 | 141 | 12/25/2024 | |
| 1.0.38 | 346 | 12/23/2024 | |
| 1.0.37 | 307 | 12/23/2024 | |
| 1.0.36 | 121 | 12/23/2024 | |
| 1.0.35 | 171 | 12/23/2024 | |
| 1.0.34 | 422 | 12/19/2024 | |
| 1.0.33 | 287 | 12/16/2024 | |
| 1.0.32 | 372 | 12/6/2024 | |
| 1.0.31 | 327 | 12/5/2024 | |
| 1.0.30 | 196 | 12/4/2024 | |
| 1.0.29 | 320 | 12/2/2024 | |
| 1.0.28 | 174 | 12/2/2024 | |
| 1.0.27 | 197 | 12/2/2024 | |
| 1.0.26 | 264 | 12/1/2024 | |
| 1.0.25 | 247 | 12/1/2024 | |
| 1.0.24 | 220 | 11/30/2024 | |
| 1.0.23 | 171 | 11/29/2024 | |
| 1.0.22 | 278 | 11/27/2024 | |
| 1.0.21 | 239 | 11/26/2024 | |
| 1.0.20 | 246 | 11/20/2024 | |
| 1.0.19 | 368 | 11/15/2024 | |
| 1.0.18 | 236 | 11/14/2024 | |
| 1.0.17 | 236 | 11/13/2024 | |
| 1.0.16 | 513 | 11/4/2024 | |
| 1.0.15 | 237 | 11/1/2024 | |
| 1.0.14 | 649 | 10/17/2024 | |
| 1.0.13 | 470 | 10/7/2024 | |
| 1.0.12 | 211 | 10/4/2024 | |
| 1.0.11 | 397 | 9/23/2024 | |
| 1.0.10 | 199 | 9/20/2024 | |
| 1.0.10-pre.1 | 73 | 12/27/2024 | |
| 1.0.9 | 199 | 9/19/2024 | |
| 1.0.8 | 227 | 9/19/2024 | |
| 1.0.7 | 148 | 9/19/2024 | |
| 1.0.6 | 209 | 9/19/2024 | |
| 1.0.5 | 163 | 9/18/2024 | |
| 1.0.4 | 160 | 9/18/2024 | |
| 1.0.3 | 290 | 9/18/2024 | |
| 1.0.2 | 209 | 9/18/2024 | |
| 1.0.1 | 289 | 9/14/2024 | |
| 1.0.0 | 179 | 9/14/2024 |