+ fileInput + JSON issue


I've developed a simple Shiny app, where the first step for the user is to load a JSON file with a fileInput gadget.

In the UI the code, it is something like this:

fileInput("file1", "Chose JSON file",
                                         multiple = FALSE,
                                         accept = c(".json", 

In the Server side, it goes like this:

    variables$data = read_json(input$file1$datapath, simplifyVector = TRUE)
    output$message1 <- renderText({
      "Loaded file"

When I run the app locally, it works perfectly (although I have to set a shiny.maxRequestSize higher due to usually high JSON sizes). However, once I deploy the app to, the loading of a JSON file doesn't work anymore. The loading bar keeps moving, and doesn't stop with the message "Upload complete" as it does locally.

Do you have any idea why this is happening? I've even tried to change the file extension of a JSON file to a CSV one trying to do the trick, but it didn't work either.

Any suggestion will be really helpful. Thanks in advance!

welcome @pqc90!

I have seen issues like this before and it might be caused by the fact that the uploaded file has an encoding that's not compatible with This is a unix platform and has a UTF-8 locale. See documentation

Hi Ger!

Thank you very much for your answer. I've tried to change the encoding of the JSON file to different types, but it doesn't work anyway. However, I think that this is not the problem, as the same file loads correctly if it is done by an ActionButton that selects it automatically, but not through the fileInput via.

Any other possible option? Thanks again!

@pqc90 can you create a reprex as described in . This will make it easier for us to help you

Hi again Ger,

I've solved the issue reducing the JSON file size. Although this doesn't help me if I want to use the larger one, it is a suitable option for my application. Thanks again for your help!

no problem, glad you got it working.
There's a max upload size indeed, you can increase the it by setting the shiny.maxRequestSize option. For example, adding options(shiny.maxRequestSize=30*1024^2) to the top of server.R would increase the limit to 30MB.

Yes, I know about the shiny.maxRequestSize as I said in the original message. Locally it works with the big JSON, but once I deploy in, it stops working with the large ones. Thanks again for your help!!

1 Like

Hello everyone ! I have the same file size issue, is there a way to pass the options(shiny.maxRequestSize=30*1024^2) to ??