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

https://github.com/vsavik/jsondyno

Jsondyno is a C# library that leverages the dynamic keyword to provide intuitive and flexible access to JSON object properties.
https://github.com/vsavik/jsondyno

dynamic json serialization

Last synced: 5 months ago
JSON representation

Jsondyno is a C# library that leverages the dynamic keyword to provide intuitive and flexible access to JSON object properties.

Awesome Lists containing this project

README

          

# Jsondyno

Jsondyno is a C# library that allows you to use the `dynamic` keyword to access JSON object properties without model classes.

## Quick start

Install [NuGet](https://www.nuget.org/packages/Jsondyno) package and add `DynamicObjectJsonConverter` to [`JsonSerializerOptions`](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializeroptions) instance:

```csharp
using Jsondyno;

var opts = new JsonSerializerOptions
{
Converters = { new DynamicObjectJsonConverter() }
};

string json = """
{
"MyProperty": 11
}
""";

dynamic obj = JsonSerializer.Deserialize(json, opts)!;
int myProperty = obj.MyProperty;

Console.WriteLine(myProperty); // Output: 11
```

*Jsondyno* uses [`System.Text.Json`](https://learn.microsoft.com/en-us/dotnet/api/system.text.json) library to parse JSON, so `dynamic` object property name conversion fully satisfy configuration settings:

- [JsonSerializerOptions.PropertyNamingPolicy](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializeroptions.propertynamingpolicy)
- [JsonSerializerOptions.PropertyNameCaseInsensitive](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializeroptions.propertynamecaseinsensitive)

More usage topic can be found [here](./docs/Usage.md).

## Documentation

- [How to use *Jsondyno*](./docs/Usage.md)
- [Advanced - *Jsondyno* internals](./docs/Advanced.md)
- [Benchmarks](./docs/Benchmarks.md)
- [Development Guides](./docs/Development.md)

## Contributing

When contributing to the *Jsondyno* repo, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note the [code of conduct](.github/CODE_OF_CONDUCT.md), please follow it in all your interactions with the project.

How to deal with security issues check security [page](.github/SECURITY.md).

## License

Jsondyno is licensed under the [MIT](LICENSE) license.