Darwinbox Interview Question

how will you detect a loop in json object in Javascript