Given the words are in an array you can use jQuery inArray() do this:
var words = ["word1","word2","word3","word4","word5"]
beforeTagAdded: function(event, ui) {
// if ui.tag exists in swearWords.json
// Then output error
var word = "word4"; // I'm assuming you get the word from some control though.
if($.inArray(word , words) > -1){
$('#banned_error').html('You can use this word.')
}
}
DEMO - Checking entered word is in array
Code from DEMO:
<input id="word" type="text"></input>
<button id="checkWord" type="button">Check Word</button>
var words = ["word1","word2","word3","word4","word5"]
$("#checkWord").on("click", function(){
var word = $("#word").val();
if($.inArray(word, words) > -1){
alert("You cannot use this word");
}
});