Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ignatandrei/RSCG_JSON2Class
Transform any json ( including appsettings ) into a class
https://github.com/ignatandrei/RSCG_JSON2Class
Last synced: about 1 month ago
JSON representation
Transform any json ( including appsettings ) into a class
- Host: GitHub
- URL: https://github.com/ignatandrei/RSCG_JSON2Class
- Owner: ignatandrei
- License: mit
- Created: 2024-02-29T04:51:48.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-07-09T21:24:00.000Z (5 months ago)
- Last Synced: 2024-11-07T17:08:32.271Z (about 1 month ago)
- Language: C#
- Size: 23.4 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- RSCG_Examples - https://github.com/ignatandrei/RSCG_JSON2Class
README
# RSCG_JSON2Class
Transform any json ( including appsettings ) into a class## Usage
Install the nuget package into your project
```xml
true
$(BaseIntermediateOutputPath)\GX
True```
Verify that the json file is set analyzer ( and , if you want to deserialize, copy to the output directory)
```xml
PreserveNewest
```
Access from C# code
```csharp
using System.Text.Json;
var testData = JsonSerializer.Deserialize(System.IO.File.ReadAllText("testData.json"));
ArgumentNullException.ThrowIfNull(testData);
Console.WriteLine(testData.Logging.LogLevel.Default);
Console.WriteLine(testData.DictData.Number_2);
```