RJSONIO fromJSON error

Viewed 371

I have a problem with the fromJSON function in RJSONIO package in R.

I have a json file to read with fromJSON

{"indy movies" :[
{
"name" : "Raiders of the Lost Ark",
"year" : 1981,
"actors" : {
    "Indiana Jones": "Harrison Ford", 
    "Dr. René Belloq": "Paul Freeman" 
    },
"producers": ["Frank Marshall", "George Lucas", "Howard Kazanjian"],
"budget" : 18000000,
"academy_award_ve": true
},
{
"name" : "Indiana Jones and the Temple of Doom",
"year" : 1984,
"actors" : {
    "Indiana Jones": "Harrison Ford", 
    "Mola Ram": "Amish Puri"
    },
"producers": ["Robert Watts"],
"budget" : 28170000,
"academy_award_ve": true
},
{
"name" : "Indiana Jones and the Last Crusade",
"year" : 1989,
"actors" : {
    "Indiana Jones": "Harrison Ford", 
    "Walter Donovan": "Julian Glover"
    },
"producers": ["Robert Watts", "George Lucas"],
"budget" : 48000000,
"academy_award_ve": false
}]}

The file name is "indy.json"

Here is a reproducible example:

indy <- fromJSON(content = "indy.json")

However,i get the result:

> indy <- fromJSON(content = "indy.json")
Error in nchar(content) : invalid multibyte string, element 1

Here is my relevant sessionInfo()

R version 3.3.3 (2017-03-06)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.4

Can anyone please suggest why this is happening?

2 Answers

There are some Invisible characters in indy.json Delete it, the problem will be solved.

enter image description here

Related