Inheritance: System.Xml.XmlDictionaryWriter, IXmlJsonWriterInitializer
 static XElement AddSampleJson(XElement content, string title, string label)
 {
     StringBuilder sample = new StringBuilder();
     using (MemoryStream stream = new MemoryStream())
     {
         using (XmlJsonWriter writer = new XmlJsonWriter())
         {
             writer.SetOutput(stream, Encoding.Unicode, false);
             content.WriteTo(writer);
         }
         stream.Position = 0;
         sample.Append(new StreamReader(stream, Encoding.Unicode).ReadToEnd());
     }
     int depth = 0;
     bool inString = false;
     for (int i = 0; i < sample.Length; ++i)
     {
         if (sample[i] == '"')
         {
             inString = !inString;
         }
         else if (sample[i] == '{')
         {
             sample.Insert(i + 1, "\n" + new String('\t', ++depth));
             i += depth + 1;
         }
         else if (sample[i] == ',' && !inString)
         {
             sample.Insert(i + 1, "\n" + new String('\t', depth));
         }
         else if (sample[i] == '}' && depth > 0)
         {
             sample.Insert(i, "\n" + new String('\t', --depth));
             i += depth + 1;
         }
     }
     return AddSample(sample.ToString(), title, label);
 }
 public static XmlDictionaryWriter CreateJsonWriter(Stream stream, Encoding encoding, bool ownsStream, bool indent, string indentChars)
 {
     XmlJsonWriter writer = new XmlJsonWriter(indent, indentChars);
     writer.SetOutput(stream, encoding, ownsStream);
     return writer;
 }
 public static XmlDictionaryWriter CreateJsonWriter(Stream stream, Encoding encoding, bool ownsStream)
 {
     XmlJsonWriter xmlJsonWriter = new XmlJsonWriter();
     xmlJsonWriter.SetOutput(stream, encoding, ownsStream);
     return (XmlDictionaryWriter)xmlJsonWriter;
 }