Skip to content

Commit 5ef263b

Browse files
robertlysonHavret
authored andcommitted
Update README.md
Thought it will be good idea to include `JsonLowerCaseNamingPolicy` in example, started to look for it in google and then realized it's a custom policy. Maybe also good to include this naming policy in source code so folks don't need to create it? Let me know, happy to do it.
1 parent b1b1947 commit 5ef263b

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ jsonSerializerOptions.PropertyNamingPolicy = new JsonLowerCaseNamingPolicy();
2525
jsonSerializerOptions.AddProtobufSupport();
2626
```
2727

28+
```csharp
29+
private class JsonLowerCaseNamingPolicy : JsonNamingPolicy
30+
{
31+
public override string ConvertName(string name)
32+
{
33+
return name.ToLower();
34+
}
35+
}
36+
```
37+
2838
You need to pass the options each time you want to serialize:
2939

3040
```csharp
@@ -73,4 +83,4 @@ Apple M1 Pro, 1 CPU, 10 logical and 10 physical cores
7383

7484
## License
7585

76-
This project uses [MIT licence](https://github.com/Havret/Protobuf.System.Text.Json/blob/main/LICENSE). Long story short - you are more than welcome to use it anywhere you like, completely free of charge and without oppressive obligations.
86+
This project uses [MIT licence](https://github.com/Havret/Protobuf.System.Text.Json/blob/main/LICENSE). Long story short - you are more than welcome to use it anywhere you like, completely free of charge and without oppressive obligations.

0 commit comments

Comments
 (0)