Example #1
0
        public static string PrettyJson(StringBuilder sIn, JsonFormatSettings formatSettings, bool sorted = false)
        {
            string indent = "\t";

            if (!formatSettings.UseTabs)
            {
                indent = "".PadRight(formatSettings.TabWidth);
            }

            using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(sIn.ToString())))
                using (var sr = new StreamReader(ms))
                    if (sorted)
                    {
                        return(new ijsonParser().PrettySorted(sr, indent, formatSettings.EolMode));
                    }
                    else
                    {
                        return(new ijsonParser().Pretty(sr, indent, formatSettings.EolMode));
                    }
        }
Example #2
0
 public static string PrettyJsonSorted(StringBuilder sIn, JsonFormatSettings formatSettings)
 {
     return(PrettyJson(sIn, formatSettings, true));
 }