Achilles icon indicating copy to clipboard operation
Achilles copied to clipboard

Fix fromJSON correct method usage

Open ziporah opened this issue 1 year ago • 6 comments

This is a possible fix for #726

ziporah avatar Nov 17 '23 06:11 ziporah

I do not believe this is correct, from the usage documentation:

fromJSON( json_str, file, method = "C", unexpected.escape = "error", simplify = TRUE )

The change made from fromJSON(file = xxx} is not the same as fromJSON(xxx).

chrisknoll avatar Jan 10 '24 13:01 chrisknoll

You are looking at the wrong documentation @chrisknoll. What you quoted is the fromJSON function from the rjson package. Achillles however switched to the jsonlite package a year ago. The documentation of the fromJSON function that Achilles actually has within its namespace is thus:

fromJSON(
  txt,
  simplifyVector = TRUE,
  simplifyDataFrame = simplifyVector,
  simplifyMatrix = simplifyVector,
  flatten = FALSE,
  ...
)

Specifying file = xxx thus ensures that the path argument just gets passed into the ..., thus the errors about fromJSON missing its txt argument anyone trying to use the current production version of your package encounters.

Blappchri avatar Jan 19 '24 07:01 Blappchri

Thanks for the clarification. Wasn't aware about the change in the JSON library.

chrisknoll avatar Jan 25 '24 14:01 chrisknoll

Hi @chrisknoll, @fdefalco

+1 for the patch! 👍

I know that I’m not supposed to do it, but… I’m still using AchillesExport for it’s really convenient and not being able to export is a real blocker.

tlecarrour-ee avatar Feb 23 '24 15:02 tlecarrour-ee

@fdefalco +1 for this PR I reviewed it and it makes sense to me.

vojtechhuser avatar Mar 03 '24 00:03 vojtechhuser

Another request for this PR to be reviewed and merged: https://forums.ohdsi.org/t/error-in-jsonlite-fromjson-file-treemapfile-argument-txt-is-missing-with-no-default/19069/9?u=chris_knoll

chrisknoll avatar Mar 13 '24 13:03 chrisknoll

We are getting the same error :( I am unable to find the function exportToJson.R inside Achilles package directory to make the edits per PR. Any thoughts on this?

KAR2022 avatar Jul 26 '24 20:07 KAR2022