Fixing "Incomplete final line"-error in R (json file)