Skip to content

Instantly share code, notes, and snippets.

@mythz

mythz/main.cs

Created May 14, 2020
Embed
What would you like to do?
Using custom Guid in JSON
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();
<?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