Changed parseJSON so it can work with any input range.