- 
                Notifications
    You must be signed in to change notification settings 
- Fork 21
Description
Is your feature request related to a problem? Please describe.
I'd like to format my JSON with camelcase properties, since I am using a backend for visualization of logs (Grafana Loki) which adheres to that standard. The possibility to do so is also mentioned in https://nblumhardt.com/2021/06/customize-serilog-json-output/
Describe the solution you'd like
Use Serilog Expression to create CamelCase keys in JSON body.
Describe alternatives you've considered
I tried creating my own custom resolver to do this, but I didn't manage to get it correctly.
new ExpressionTemplate(
    "{{ \"timestamp\": \"{UtcDateTime(@t)}\", \"message\": \"{@m}\", \"level\": \"{@l}\", \"exception\": \"{@x}\",\n" +
    " {#each name, value in @p} \"{IsCamelCase(name)}\": " +
    "{#if name = 'ExceptionDetail'}" +
    "{value:j},"+
    "{#else}"+
    "\"{value}\"," +
    "{#end}{#end} }}\n"
    , nameResolver: CamelCaseResolvers))
I think this also quite quickly became too complex from maintainability standpoint.
What I want to achieve
{
    "Timestamp": "2022-11-17T07:58:15.6253633Z",
    "Message": "An unhandled exception has occurred while executing the request.",
    "Level": "Error",
    "Exception": "Exception Text"
}
should be
{
    "timestamp": "2022-11-17T07:58:15.6253633Z",
    "message": "An unhandled exception has occurred while executing the request.",
    "level": "Error",
    "exception": "Exception Text"
}
Additional context
As discussed with @nblumhardt on Twitter, I open my thread here.
Hope to get any good insights for finding a smart solution I might've overlooked!