$(window).ready(
    function () {
        $("#json-input").linedtextarea();

        $("#json-input").bind('paste', function() {
            // Need a timeout since paste event does not give the content
            // of the clipboard.
            setTimeout(function(){
                validate_input($("#json-input").val());
            },100);
        });

        $("#json-input").blur(function() {
            validate_input($("#json-input").val());
        });

        $("#submit").attr("disabled", "disabled");
    });

validate_input = function(json_input) {

    if ($("#json-input").val().split("\n").length == 1) {
        load_url();
    } else {
        validate_job_data(json_input);
    }
}

load_url = function() {
    // Loads JSON content if URL is provided in the json text area.
    if ($("#json-input").val().split("\n").length == 1) {
        $.ajax({
            type: "POST",
            url: remote_json_url,
            data: {
                "url": $("#json-input").val().trim(),
                "csrfmiddlewaretoken": $("[name='csrfmiddlewaretoken']").val()
            },
            success: function(data) {
                $("#json-input").val(data);
                validate_job_data(data);
            }});
    }
}

validate_job_data = function(data) {
    $.post(window.location.pathname,
           {"json-input": data,
            "csrfmiddlewaretoken": $("[name='csrfmiddlewaretoken']").val()},
           function(data) {
               if (data == "success") {
                   $("#json-valid-container").html("Valid JSON.");
                   valid_json_css(true);
                   $("#submit").removeAttr("disabled");
                   unselect_error_line();
               } else {
                   $("#json-valid-container").html(
                       data.replace("[u'", "").replace("']", ""));
                   valid_json_css(false);
                   $("#submit").attr("disabled", "disabled");
                   select_error_line(data);
               }
           }, "json");
}


valid_json_css = function(success) {
    // Updates the css of the json validation container with appropriate msg.
    if (success) {
        $("#json-valid-container").css("backgound-color", "#50ef53");
        $("#json-valid-container").css("color", "#139a16");
        $("#json-valid-container").css("border-color", "#139a16");
        $("#json-valid-container").show();
    } else {
        $("#json-valid-container").css("backgound-color", "#ff8383");
        $("#json-valid-container").css("color", "#da110a");
        $("#json-valid-container").css("border-color", "#da110a");
        $("#json-valid-container").show();
    }
}

unselect_error_line = function() {
    // Unselect any potential previously selected lines.
    $(".lineno").removeClass("lineselect");
}

select_error_line = function(error) {
    // Selects the appropriate line in text area based on the parsed error msg.
    line_string = error.split(": ")[1];
    line_number = parseInt(line_string.split(" ")[1]);

    $(".lineno").removeClass("lineselect");
    $("#lineno"+line_number).addClass("lineselect");

    // Scroll the textarea to the highlighted line.
    $("#json-input").scrollTop(
        line_number * (parseInt($("#lineno1").css(
            "height")) - 1) - ($("#json-input").height() / 2));
}

@@ -1127,32 +1127,97 @@
 unction(data) %7B%0A
+                try %7B%0A                    $.parseJSON(data);%0A    
                 
@@ -1252,32 +1252,36 @@
                 
+  
+  
 validate_job_dat
@@ -1281,32 +1281,264 @@
 job_data(data);%0A
+                %7D catch (e) %7B%0A                    $(%22#json-valid-container%22).html(%22Invalid JSON: %22 + data);%0A                    valid_json_css(false);%0A                    $(%22#submit%22).attr(%22disabled%22, %22disabled%22);%0A                %7D%0A
             %7D%7D);
@@ -2140,16 +2140,81 @@
 ce(%22'%5D%22,
+ %22%22).%0A                           replace('%5Bu%22', %22%22).replace('%22%5D',
  %22%22));%0A 

Add more client-side validation.