-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
[![.NET](https://github.com/konak/am.kon.packages.common.json/actions/workflows/dotnet.yml/badge.svg?branch=main)](https://github.com/konak/am.kon.packages.common.json/actions/workflows/dotnet.yml) | ||
|
||
# am.kon.packages.common.json | ||
# JsonCommonExtensions | ||
|
||
A utility class providing common JSON serialization and deserialization extensions. | ||
|
||
## Usage | ||
|
||
### Serialization | ||
```csharp | ||
var myObject = new { Name = "John", Age = 30 }; | ||
string jsonString = myObject.ToJson(); | ||
|
||
### Deserialization | ||
```csharp | ||
string jsonString = "{\"name\":\"John\",\"age\":30}"; | ||
var myObject = jsonString.ToObject<dynamic>(); | ||
|
||
### Custom Serialization Options | ||
```csharp | ||
var options = new JsonSerializerOptions { WriteIndented = true }; | ||
JsonCommonExtensions.Configure(options); | ||
string jsonString = myObject.ToJson(options); | ||
|
||
### Configuration | ||
Use the JsonCommonExtensions.Configure method to set custom serialization options. | ||
```csharp | ||
var options = new JsonSerializerOptions { WriteIndented = true }; | ||
JsonCommonExtensions.Configure(options); | ||
|
||
|
||
This README provides a brief description, usage examples, and configuration instructions for your class. |