CSharp examples for Newtonsoft.Json:JsonConvert.DeserializeObject
Object to Bytes by Json
using System.Threading.Tasks; using System.Linq; using System.Collections.Generic; using System;// ww w .j a va2s .c o m using Newtonsoft.Json; public class Main{ public static byte[] Object2Bytes(object obj) { string json = JsonConvert.SerializeObject(obj); byte[] serializedResult = System.Text.Encoding.UTF8.GetBytes(json); return serializedResult; } }