Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ignatandrei/RSCG_JSON2Class

Transform any json ( including appsettings ) into a class
https://github.com/ignatandrei/RSCG_JSON2Class

Last synced: about 2 months ago
JSON representation

Transform any json ( including appsettings ) into a class

Awesome Lists containing this project

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);
```