Esempio n. 1
0
        /// <summary>
        /// Creates a JSON representation for an object with serialization manager override.
        /// </summary>
        /// <param name="data">The object to be serialized.</param>
        /// <param name="manager">The <see cref="SerializationManager"/> to control advanced JSON serialization.</param>
        /// <returns>The serialized JSON string.</returns>
        public static string ToJson(object data, SerializationManager manager)
        {
            //param.FixValues();

            if (data == null)
            {
                return("null");
            }

            var w  = new JsonStringWriter(new System.Text.StringBuilder());
            var js = new JsonSerializer(manager ?? Json.Manager, w);

            js.ConvertToJSON(data);
            return(w.ToString());
        }
Esempio n. 2
0
 internal JsonSerializer(SerializationManager manager, JsonStringWriter writer) : this(manager) {
     OutputChar      = writer.Write;
     OutputCharArray = writer.Write;
     OutputText      = writer.Write;
     OutputString    = manager.UseEscapedUnicode ? writer.WriteStringEscapeUnicode : (WriteText)writer.WriteString;
 }