What am I doing wrong here, Guids are being serialized without dashes ?
Seems to be working as expected:
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(); //= {"Guid":"1f595912-db8a-4723-bd9f-fbe203b77673"}
Maybe you’re trying to configure it at runtime? All static configuration like JsConfig
should only be done once on Startup (e.g. in your AppHost.Configure()
or plugin registration).
I think that was indeed the problem, I shifted it and it was good. Thanks Mythz
1 Like