Nancy.Serialization.JsonNet
NewtonSoft.Json serializer for Nancy
Install / Use
/learn @NancyFx/Nancy.Serialization.JsonNetREADME
Implementations of the ISerialization and IBodyDeserializer interfaces, based on Json.NET, for Nancy
Usage
Start of by installing the Nancy.Serialization.JsonNet nuget
When Nancy detects that the JsonNetSerializer and JsonNetBodyDeserializer types are available in the AppDomain, of your application, it will assume you want to use them, rather than the default ones.
Customization
If you want to customize the behavior of Json.NET, you can provide your own implementation of the JsonSerializer type. For example, the following implementation configures Json.NET to use camel-casing and to indent the output
public class CustomJsonSerializer : JsonSerializer
{
public CustomJsonSerializer()
{
this.ContractResolver = new CamelCasePropertyNamesContractResolver();
this.Formatting = Formatting.Indented;
}
}
In order for Nancy to know that you want to use the new configuration, you need to register it in your bootstrapper. Here is an example of how you would do that using the DefaultNancyBootstrapper
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ConfigureApplicationContainer(TinyIoCContainer container)
{
base.ConfigureApplicationContainer(container);
container.Register<JsonSerializer, CustomJsonSerializer>();
}
}
Code of Conduct
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the .NET Foundation Code of Conduct.
Contribution License Agreement
Contributing to Nancy requires you to sign a contribution license agreement (CLA) for anything other than a trivial change. By signing the contribution license agreement, the community is free to use your contribution to .NET Foundation projects.
.NET Foundation
This project is supported by the .NET Foundation.
Copyright
Copyright © 2010 Andreas Håkansson, Steven Robbins and contributors
License
Nancy.Serialization.JsonNet is licensed under MIT. Refer to license.txt for more information.
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
