Skip to content

Instantly share code, notes, and snippets.

Created May 14, 2020
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();
<?xml version="1.0" encoding="utf-8"?>
<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" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment