/// <summary> /// Convert JObject to .NET object /// </summary> /// <typeparam name="T">Type of .NET object</typeparam> /// <param name="netArray">Object array to serialize</param> /// <returns>Json array</returns> public JArray SerializeArray <T>(IEnumerable <T> netArray) { JConstructor jc = new JConstructor(); CreateSerializer().Serialize(jc.CreateWriter(), netArray); return((JArray)jc.First); }
/// <summary> /// Convert .NET object to JObject /// </summary> /// <typeparam name="T">Type of .NET object</typeparam> /// <param name="netObject">Object to serialize</param> /// <returns>Json object</returns> public JObject Serialize <T>(T netObject) { JConstructor jc = new JConstructor(); CreateSerializer().Serialize(jc.CreateWriter(), netObject); return((JObject)jc.First); }