Adding JSON data
Once you have created your project, you’re taken to the Data view. It’s time to upload a JSON file to use as a sample while you develop your project. First, a few notes:
Note
For a refresher on the JSON data-interchange format, see json.org.
For other requirements, see Describing a JSON object.
To upload JSON data, complete the following steps:
Download the sample data for this tutorial. The file name is
JSON_Tutorial_Data.zip
.Unzip the downloaded file to extract its contents to a location on your drive.
From your file explorer, drag the JSON file (
Tut_1.json
) into the Drag and Drop section of the Data view. (If preferred, you can browse to select the file).Click Continue. You should see this:
The raw data shown in the left pane includes sales figures for offices in three states, for one month (August 2017). It also includes data about each office's sales manager and the number of employees.
The left pane is not only for display; it doubles as an editor in which you can amend the data. This is useful while developing because it lets you test different data scenarios.
The right pane — the Object Model — shows the same data but with collapsible elements. This makes it easier to understand a data structure that nests JSON objects and arrays.
You may notice that this sample data has two arrays: one for
states
and the other foroffices
. Theoffices
array has six objects: these are for the cities where the offices are located.In the top right of the screen, you can see these two buttons:
The Import new sample data button lets you load other JSON files from your local drive into the editor. This is useful for trying out different data scenarios. You can have different input files for different scenarios and load the appropriate one when you wish to see how your application responds.
The Export data to file button lets you export the project's sample data as a JSON file. This is helpful if you prefer to amend the sample data in a code editor such as Notepad++.
So, we’ve loaded sample JSON data into our project. Now it’s time to begin crafting our narrative.