Skip to content

Instantly share code, notes, and snippets.

@mythz mythz/main.cs
Created Apr 23, 2019

Embed
What would you like to do?
Test string DeSerilizeFn
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
JsConfig<string>.DeSerializeFn = str => str?.Trim();
public class Test
{
public string Name { get; set; }
public string Age { get; set; }
public string Description { get; set; }
}
var dto = new Test { Name = " John Doe ", Age = "18" };
var json = dto.ToJson();
var fromDto = json.FromJson<Test>();
var isDescriptionNull = fromDto.Description == null;
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.Memory" version="4.5.2" targetFramework="net45" />
<package id="ServiceStack.Text" version="5.5.0" targetFramework="net45" />
<package id="ServiceStack.Client" version="5.5.0" targetFramework="net45" />
<package id="ServiceStack.Interfaces" version="5.5.0" targetFramework="net45" />
</packages>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.