Created
August 22, 2023 06:36
-
-
Save pingkunga/245300752601123d61b250ff9a4fabbd to your computer and use it in GitHub Desktop.
TCP_JSON#05
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
//JSONHelper | |
private static readonly JsonSerializerSettings _SerializerSettings = new JsonSerializerSettings() | |
{ | |
NullValueHandling = NullValueHandling.Ignore | |
}; | |
public static Byte[] serializeObject<T>(T pObj) | |
{ | |
String JSON = JsonConvert.SerializeObject(pObj, typeof(T), _SerializerSettings); | |
return Encoding.Unicode.GetBytes(JSON); | |
} | |
public static T deserialize<T>(String pObj) | |
{ | |
return JsonConvert.DeserializeObject<T>(pObj, _SerializerSettings); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment