0

I have plumber version 1.0.0 installed and I also installed jsonlite 1.7.1 when I try to load library(jsonlite) I get back:

Error in value[[3L]](cond) : 
  Package ‘jsonlite’ version 1.6 cannot be unloaded:
 Error in unloadNamespace(package) : namespace ‘jsonlite’ is imported by ‘webutils’, ‘plumber’ so cannot be unloaded
In addition: Warning message:
package ‘jsonlite’ was built under R version 3.6.3 

So I thought that some of jsonlite functions are already available through plumber, but toJSON(some_df, pretty = T) generates error:

Error in toJSON(some_df, pretty = T) : could not find function "toJSON"

Any thoughts?

user1700890
  • 7,144
  • 18
  • 87
  • 183
  • restart your R session, you loaded plumber first (which sideloaded jsonlite), then you installed jsonlite. The error is telling you that jsonlite 1.6 is already loaded and you cannot load jsonlite 1.7 without unloading it first. Since it was loaded by plumber, you would need to unload plumber namespace first. Restart your R session and reload plumber. – Bruno Tremblay Sep 21 '20 at 16:34
  • 1
    you can use loaded namespace function using jsonlite::toJSON for example. If the namespace is not loaded, R will hot load it for you. – Bruno Tremblay Sep 21 '20 at 16:36
  • Thank you. Bruno! I will go with `jsonlite::toJSON`. I want to keep whatever comes with `plumber` – user1700890 Sep 21 '20 at 16:40

0 Answers0