Exemple #1
0
        private void BeautifyJsonHandler(object sender, EventArgs e)
        {
            try
            {
                var textToBeautify = textEditor.SelectedText;
                if (textToBeautify.IsNullOrEmpty())
                {
                    textToBeautify = textEditor.Text;
                }

                string beautifiedText = JsonBeautifier.Beautify(textToBeautify);

                if (!textEditor.SelectedText.IsNullOrEmpty())
                {
                    textEditor.SelectedText = beautifiedText;
                }
                else
                {
                    textEditor.Text = beautifiedText;
                }
            }
            catch (Exception ex)
            {
                output.Text = "Exception : " + ex;
            }
        }
Exemple #2
0
 public static string BeautifyJson(this string json)
 {
     return(JsonBeautifier.Beautify(json));
 }