Пример #1
0
        public static string Serialize(object obj)
        {
            var instance = new Serializer();

            instance.SerializeValue(obj);

            return instance.builder.ToString();
        }
        public static string SerializeHumanReadable(object obj)
        {
            var serializer = new Serializer(obj);

            serializer.makeHumanReadable = true;

            return serializer.Serialize();
        }
        /// <summary>
        /// Converts a IDictionary / IList object or a simple type (string, int, etc.) into a JSON string
        /// </summary>
        /// <param name="json">A Dictionary&lt;string, object&gt; / List&lt;object&gt;</param>
        /// <returns>A JSON encoded string, or null if object 'json' is not serializable</returns>
        public static string Serialize(object obj)
        {
            var serializer = new Serializer(obj);

            return serializer.Serialize();
        }
 /// <summary>
 /// Converts a IDictionary / IList object or a simple type (string, int, etc.) into a JSON string
 /// </summary>
 /// <param name="json">A Dictionary&lt;string, object&gt; / List&lt;object&gt;</param>
 /// <returns>A JSON encoded string, or null if object 'json' is not serializable</returns>
 public static string Serialize(object obj) {
     return Serializer.Serialize(obj);
 }