Beispiel #1
0
        /// <summary>
        /// Serializes the specified JsonData to a string value.
        /// </summary>
        public static string Serialize(JsonData data, JsonSerializeOptions options)
        {
            if (!JsonSerializeSafety.IsJsonSafe(data, options))
            {
                throw new Exception("JsonSerializer.Serialize - Failed to serialize data. See console for details.");
            }

            return(new JsonSerializer(data.Value, options).sb.ToString());
        }
Beispiel #2
0
 /// <summary>
 /// Returns the string representation of this object using specified options.
 /// </summary>
 public string ToString(JsonSerializeOptions options)
 {
     return(JsonSerializer.Serialize(this, options));
 }
Beispiel #3
0
 /// <summary>
 /// Returns a json representation of specified object and options.
 /// </summary>
 public static string ToString(object data, JsonSerializeOptions options)
 {
     return(JsonSerializer.Serialize(new JsonData(data), options));
 }
Beispiel #4
0
 private JsonSerializer(object data, JsonSerializeOptions options)
 {
     sb           = new StringBuilder();
     this.options = options;
     Process(data);
 }