-2
Current Data


Sr. Genres
1   [{"id": 28, "name": "Action"}, {"id": 12, "name": "Adventure"}, {"id": 14, "name": "Fantasy"}, {"id": 878, "name": "Science Fiction"}]
2   [{"id": 12, "name": "Adventure"}, {"id": 14, "name": "Fantasy"}, {"id": 28, "name": "Action"}]
3   [{"id": 28, "name": "Action"}, {"id": 12, "name": "Adventure"}, {"id": 80, "name": "Crime"}]
4   [{"id": 28, "name": "Action"}, {"id": 80, "name": "Crime"}, {"id": 18, "name": "Drama"}, {"id": 53, "name": "Thriller"}]
5   [{"id": 28, "name": "Action"}, {"id": 12, "name": "Adventure"}, {"id": 878, "name": "Science Fiction"}]

Required Output

Sr. id  name    id  name    id  name    id  name
1   28  Action  12  Adventure   14  Fantasy 878 Science Fiction
2   12  Adventure   14  Fantasy 28  Action      
3   28  Action  12  Adventure   80  Crime   53  Thriller
4   28  Action  80  Crime   18  Drama       
5   28  Action  12  Adventure   878 Science Fiction     

Any help how to do this?

NelsonGon
  • 13,015
  • 7
  • 27
  • 57
  • 2
    Is this not just importing a JSON string into a table? See https://stackoverflow.com/questions/20925492/how-to-import-json-into-r-and-convert-it-to-table – xvf Mar 27 '19 at 17:49

1 Answers1

0

Just use the RJSON package. ...

#First install JSON Package:
install.packages("rjson")

# Load the package to your workspace
library(rjson)

# read your input file, assuming this is called input.json
result <- fromJSON(file = "input.json")

# Print the result.
out <- as.data.frame(result)

# Then export it
write.table(out,file="out.txt",sep="\t",col.names=T,row.names=F)