public void Run() { var ctx = ContextFactory.CreateContextThatContainsAllPossibleNodeTypes(); var json = ctx.ToFormattedJson(); json = "\"" + json.Replace("\r", "").Replace("\"", "\\\"").Replace("\n", "\\n\" + //\n\"") + "\""; Console.WriteLine(json); }