'R - Open Twitter Archive Data as json with R

it would be great if someone could help me with this. I want to analyze Twitter archives that users can download for themselves. I get a ZIP file from Twitter with a lot of .js data - that's where the problem starts. What I have found out so far: If I manually remove the header of the js ("window.YTD.direct_messages.part0 ="), then I can open it as JSON with RJSONIO - but I don't want to have to do that manually everywhere. Does anyone know a way to open the JS file or how I can accomplish the above steps (delete the row and open as json) in R?

That is how the js header looks like - BTW: it seems to be important not to delete the square brackets as well if you want to save it as json:

That is how the js header looks like - BTW: it seems to be important not to delete the square brackets as well if you want to save it as json



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source