Testing toJSON mmethod