Created
April 23, 2019 21:33
-
-
Save mythz/abbbb0e707e910e6379703edd442d2db to your computer and use it in GitHub Desktop.
Test string DeSerilizeFn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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