public static bool JsonValidate(TextBox control) { return((bool)WinFormHelper.TryInvoke(control, () => { try { control.Text = JToken.Parse(control.Text).ToString(Formatting.Indented); FormMain.SetStatus("Valid json script"); return true; } catch (Exception ex) { FormMain.SetStatusRed(ex.Message); control.Focus(); return false; } })); }