Darwinbox interview question

how will you detect a loop in json object in Javascript