Skip to content

Instantly share code, notes, and snippets.

@hatsunea
Created April 14, 2020 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hatsunea/c5a222e9d0cc7b84008a1a0005f03f39 to your computer and use it in GitHub Desktop.
Save hatsunea/c5a222e9d0cc7b84008a1a0005f03f39 to your computer and use it in GitHub Desktop.
var mes = new TObs()
{
messageid = Guid.NewGuid().ToString(),
source = this.SourceName,
status = "OK",
};
var options = MessagePack.MessagePackSerializerOptions.Standard.WithResolver(MessagePack.Resolvers.StandardResolverAllowPrivate.Instance);
var jsonString = MessagePack.MessagePackSerializer.ConvertToJson(MessagePack.MessagePackSerializer.Serialize<TObs>(mes, options));
[MessagePack.MessagePackObject(true)]
private class TObs
{
public string error { get; set; }
public string messageid { get; set; }
public string status { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment