Determine if JSON Object contains a value

I am creating a JSON object like this:
    window.attendees              = {};
    window.attendees.eventcode    = "GEVENT";
    window.attendees.price        = 169;
    window.attendees.WaitingList  = "";
    window.attendees.participants = [];

Open in new window

and populating it like this:
  function addParticipant() {
    var participant = {};
    // want to check here if the email to be added already exists in window.attendees.participants
    var valid = $('#checkout-step-billing .voucher_form').validationEngine('validate');
    if (valid) {
      participant.firstname   = $('#firstname').val();
      participant.lastname    = $('#lastname').val();
      participant.DOB         = $('#DOB').val();
      participant.Last4       = $('#Last4SSN').val();
      participant.PID         = $('#customer_id').val();
      participant.Phone       = $('#Phone').val();
      participant.Employer    = $('#Employer').val();
      participant.Address     = $('#Address').val();
      participant.City        = $('#City').val();
      participant.State       = $('#State').val();
      participant.Zip         = $('#Zip').val();       = $('#SomeoneElseEmail').val();
    } // if (valid)
  } // function addParticipant()

Open in new window

I need to prevent the same email address from being added twice if it already exists in window.attendees.participants.
LVL 27
Eddie ShipmanAll-around developerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

function emailIsNotFound(arrParticipants, str) {
    for(var i=0;i<arrParticipants.length;i++) {
       if( arrParticipants[i]["email"] == str ) return false;
    return true;

Open in new window

use :

  function addParticipant() {
    var participant = {};
    if( emailIsNotFound( window.attendees.participants, $('#SomeoneElseEmail').val() ) ) {

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.