Skip to content

Instantly share code, notes, and snippets.

@wwwlicious
Created December 5, 2020 16:27
Show Gist options
  • Save wwwlicious/d4dd00bbc9a150a69e782a07753c575e to your computer and use it in GitHub Desktop.
Save wwwlicious/d4dd00bbc9a150a69e782a07753c575e to your computer and use it in GitHub Desktop.
SnakeCake_Deserialize_CustomScope
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
public class Test
{
public string Id {get;set;}
public string IdName {get;set;}
}
using (var scope = JsConfig.BeginScope())
{
scope.TextCase = TextCase.SnakeCase;
var test = new Test { Id= "id", IdName = "idname" };
var json = test.ToJson();
var testOut = json.FromJson<Test>();
testOut.PrintDump();
}
// Save a copy of this *public* Gist by clicking the "Save As" below https://servicestack.net/
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ServiceStack.Text" version="5.10.0" targetFramework="net5.0" />
<package id="ServiceStack.Client" version="5.10.0" targetFramework="net5.0" />
<package id="ServiceStack.Common" version="5.10.0" targetFramework="net5.0" />
<package id="ServiceStack.Interfaces" version="5.10.0" targetFramework="net5.0" />
</packages>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment