During the modelling process, you can convert JSON/XML tree-structured data sources into a tabular format, making the data source easier to visualize. You can quickly populate columns with specific data elements from your tree-structured data source and add context to your data using formulas and properties.
To model a JSON and XML data source:
- Click Data Sources in the left navigation bar.
If you don’t see the above option, go to the bottom of the left navigation sidebar and click your Account Name > Data Sources instead.
- From your list of data sources, select the data source you want to model. Use the Format type to help you find tree structured data sources.
- Click Create modelled data source.
- Name your modelled data source. The default is the original data source name. Both the original data source and the modelled data source will be available in your list of data sources.
- Use the + sign to add a column to your modelled data source.
- Name your column. This is how it will be referenced when building Klips and metrics. Each column is automatically named according to the first value in the data selection.
- In your tree-structured data source, click the black arrows to show or hide the elements of each data node.
- Select the element of data you want to use to populate your column. All elements of data with the same name will populate your column. For example, if you select “type”, all elements of data with the name “type” will populate your column.
- To further specify the data assigned to each column, you can use the Selection Options or edit the XPath in your formula bar:
- Selection Options: When an element of data is selected, you can click the Selection Options link on the right side of the data. Here, you can choose from a list of varied selections to specify the data you want to see in your column. When you click on an option, you can see a preview of what is being selected.
- XPath: You can use the formula bar to write a specific XPath to ensure that the correct data is being selected for each column. To do this, you select an element of data and edit the XPath by double-clicking on the path in the formula bar or clicking in the formula bar to add your cursor after the path and pressing backspace on your keyboard. Edit your path between the @ and ; symbols in the formula bar.
- Add context to the columns by setting the data types, specifying data formats, and writing formulas.
- Click Save and Exit to save your model and start building a Klip or a metric.