Using the Execute Python Script or Execute R Script modules, we may import data from JSON. The Execute R Script module will be used in. Execute R Script Module will be used. In Azure ML Studio, this module is used to run R script codes.
There are three input parameters for the Execute R Script module. These are Script Bundle, Dataset1, and Dataset2. You can import data into the Execute R Script module with the aid of the Dataset1 and Dataset2 inputs. A zip file that contains many file kinds can be used with the Script Bundle port. To load JSON, we'll make advantage of this Script Bundle port.
We'll walk through importing a compressed JSON file into Azure ML. Consider the scenario where we want to use a JSON data file as a dataset for Azure ML. You must compact this JSON file after downloading the sample JSON data from JSONPlaceholder.
Select Dataset tab in Azure ML Studio and click (+) New at Bottom side.
Select FROM LOCAL FILE
Choose the SELECT A TYPE FOR THE NEW DATASET as a Zip File option and the path to the zipped JSON file.
You will receive news that the dataset upload for "SampeJSONData.zip" has been completed and the SampleJSONData file will appear on the MY DATASETS page.
Select Experiments tab and click (+) NEW.
Select any Blank Experiment option and then create a new experiment.
Locate SampleJSONData.zip and then drag it to the design panel.
Drag and drop Execute R Script Module.
Connect the Execute R Script Module Script Bundle port to the SampeJSONData.zip output.
Paste this query in Rscript box.
library(jsonlite)
myjsondata <- fromJSON("src/posts.txt")
maml.mapOutputPort ("myjsondata");
Run the experiment then right click Result Dataset port of Execute R Script module and select Visualize
We extracted the JSON data from the zip file and transformed it into a format that could be used in Azure ML
experiments. Any website can now provide JSON data to us.
Actually, The prior demonstration and this choice are quite similar. Only the source of the JSON data file is altered with this option. Previously, we had a zip file, but for this example, we'll use JSON data on a website.
Modify the R script module code:
library(jsonlite)
myjsondata <- fromJSON("https://jsonplaceholder.typicode.com/posts ")
maml.mapOutputPort("myjsondata");
Run
When you visualize the Result Dataset of R script module you can see it getting the JSONPlaceholder posts JSON data.
In the below image we can see the compare of JSON form and visualization form.