Initial Commit
This commit is contained in:
commit
69a2ef0686
10 changed files with 209 additions and 0 deletions
26
MinecraftRecipeSerializer.cs
Normal file
26
MinecraftRecipeSerializer.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace RecipeRevamper;
|
||||
|
||||
public class MinecraftRecipeSerializer
|
||||
{
|
||||
private static readonly JsonSerializerSettings _settings = new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new LowerCaseContractResolver(),
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
};
|
||||
|
||||
public static string SerializeObject(object o)
|
||||
{
|
||||
return JsonConvert.SerializeObject(o, Formatting.Indented, _settings);
|
||||
}
|
||||
|
||||
public class LowerCaseContractResolver : DefaultContractResolver
|
||||
{
|
||||
protected override string ResolvePropertyName(string propertyName)
|
||||
{
|
||||
return propertyName.ToLower();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue