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; } }
public static string BeautifyJson(this string json) { return(JsonBeautifier.Beautify(json)); }