Created
May 14, 2020 17:57
-
-
Save mythz/e4ea5983fe82c433ddf71d95e650b59e to your computer and use it in GitHub Desktop.
Using custom Guid in JSON
This file contains hidden or 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; | |
using System.Linq; | |
using ServiceStack; | |
using ServiceStack.Text; | |
JsConfig<Guid>.SerializeFn = guid => guid.ToString(); | |
public partial class Dto | |
{ | |
public Guid Guid { get; set; } = Guid.NewGuid(); | |
} | |
var dto = new Dto {}; | |
var json = dto.ToJson(); | |
json.Print(); |
This file contains hidden or 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.3" targetFramework="net45" /> | |
<package id="ServiceStack.Text" version="5.8.0" targetFramework="net45" /> | |
<package id="ServiceStack.Client" version="5.8.0" targetFramework="net45" /> | |
<package id="ServiceStack.Interfaces" version="5.8.0" targetFramework="net45" /> | |
</packages> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment