예제 #1
0
파일: Serializer.cs 프로젝트: VegK/MiniJSON
        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);
 }