Enhanced to save lines data to *.json.