Created
February 8, 2018 17:58
-
-
Save xtrmstep/292c9db972072d4a63b4ce00262c2b49 to your computer and use it in GitHub Desktop.
Get object dump in JSON with Google ProtocolBuffers
This file contains 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
public static string ToJson(this object obj) | |
{ | |
var messageLite = obj as IMessageLite; | |
if (messageLite != null) | |
return Google.ProtocolBuffers.Extensions.ToJson(messageLite); | |
return JsonConvert.SerializeObject(obj); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment