/// <summary> /// Make an JSON external form string of this JsonArray. For /// compactness, no unnecessary whitespace is added. /// </summary> /// <remarks> /// This method assumes that the data structure is acyclical. /// </remarks> public override string ToString() { JsonTextWriter writer = new JsonTextWriter(); ExportContext context = new ExportContext(); context.Export(this, writer); return writer.ToString(); }
/// <summary> /// Make an JSON external form string of this JsonArray. For /// compactness, no unnecessary whitespace is added. /// </summary> /// <remarks> /// This method assumes that the data structure is acyclical. /// </remarks> public virtual void Export(ExportContext context, JsonWriter writer) { if (context == null) throw new ArgumentNullException("context"); if (writer == null) throw new ArgumentNullException("writer"); writer.WriteStartArray(); foreach (object value in this) context.Export(value, writer); writer.WriteEndArray(); }
public void Export(ExportContext context, JsonWriter writer) { if (context == null) throw new ArgumentNullException("context"); if (writer == null) throw new ArgumentNullException("writer"); writer.WriteStartObject(); foreach (string name in NameIndexList) { writer.WriteMember(name); context.Export(InnerHashtable[name], writer); } writer.WriteEndObject(); }