Skip to content

Latest commit

 

History

History
60 lines (38 loc) · 1.6 KB

File metadata and controls

60 lines (38 loc) · 1.6 KB

How to convert an .rda file to JSON

  • Homebrew
  • RStudio
  1. Install R and RStudio
brew install R
brew install -cask rstudio
  1. Launch RStudio.
open -a RStudio

This opens a new application. Stay on the Console tab -- does what it says on the tin

Screenshot 2023-04-21 at 12 47 09 AM

The rest of the commands should be run in Rstudio

  1. Install the jsonlite package (if not already installed).
install.packages("jsonlite")
  1. Load the .rda file:

In the console:

load("path/to/your/file.rda")

Or in the Rstudio UI:

Screenshot 2023-04-21 at 12 49 28 AM

Screenshot 2023-04-21 at 12 49 36 AM

  1. Check the loaded object(s) by running:
ls()
  1. Convert the loaded object to JSON and save it to your desired location (in this example, the Desktop folder):
jsonlite::write_json(loaded_object, "~/Desktop/output_file.json")

Replace loaded_object with the name of the object you want to convert, as obtained from the ls() command.

Result:

Screenshot 2023-04-21 at 12 51 54 AM