Forum Discussion

dieptruong11's avatar
dieptruong11
New Member
9 years ago
Solved

Export data in JSON format

How can I export a table into JSON format? 
  • v-sihou-msft's avatar
    9 years ago

    dieptruong11

     

    In Power BI Desktop, you can use the R script to convert the data frame into JSON format and export into a JSON file.

     

    1. Configure your R environment. Install readr and jsonlite packages.

     

    2. Drag the fields you want to export into a R visual. Write R script below and Run:

     

    library(readr)
    library(jsonlite)
    x<-toJSON(dataset)
    cat(x)
    write_lines(x,path = "/Program Files/R/R-3.3.3/write_json.json")
    plot(dataset)
    

     

     

     

    Ps: The file need to be created first with permission granted to packages.

     

     

    You can see the generated JSON format data in R studio.

     

     

     

    Regards,