JSON sample data dialog

The JSON sample data dialog lets you load JSON data into the Data Model (see Loading data).
By default, the JSON data is mapped to corresponding fields in the existing Data Model. Data that does not correspond to any field is discarded.
You may use the Replace Data Model option to let the JSON data replace the existing Data Model.

The dialog is opened via the menu: File > Add data > JSON sample data, or via the JSON Sample Data toolbar button on the Data Model pane.

  • File: The path and name of the JSON file to use. The file is assumed to be UTF-8 encoded.
  • Browse: Opens an explorer window to browse folders and select a JSON file.
  • The box below the file name allows to paste or enter JSON data. After opening a JSON file the JSON data will appear in this box. You can review and edit the JSON.
    For the types of JSON that are accepted, see below.
  • Replace Data Model: Selecting the Replace Data Model option removes the existing Data Model from the template and creates a new Data Model based on the keys found in the JSON. When this option is not checked, the JSON data is mapped to any corresponding fields in the existing Data Model, and data that does not correspond to any field is discarded.
  • Finish: If the JSON is valid, you may click Finish to import the data into the Data Model pane. Arrays of objects are converted to records (or detail tables); key-value pairs are converted to data fields.

Types of JSON data

You can add the following types of JSON data:

  • A JSON object or an array of JSON objects representing records. The data type is derived from the data:
    • Any value surrounded with quotes is converted to a field of type String.
    • Any numeric value containing a period is converted to a field of type Float.
    • Any numeric value that does not contain a period is converted to a field of type Integer.
    • A value "true" or "false" is converted to a field of type Boolean.

    If a value in a record object is a JSON object, it is considered to be a nested table with detail records.

  • Typed JSON. This JSON follows the structure of a JSON Record Data List (see the REST API Cookbook). Field types are determined by the schema object in the JSON.

Examples

A single record with two fields
{
"first": "Peter",
"last": "Parker"
}
Two records
[{
"first": "Peter",
"last": "Parker"
},
{"first": "Martin", "last": "Moore"
}]
A single record with a detail table
{
"name":"Peter Parker",
"email":"parkerp@localhostcom",
"detail": [{"id":"inv123","ExtraData":"hello"},{"id":"456","ExtraData":"world"}]
}
A JSON Record Data List

A JSON Record Data List describes a list of data fields (as name/value pairs), a data table schema and nested data records (if any) for one or more data records. This example holds a single, simple record.

{
"data": {
	"schema": {
		"columns": {
			"ID": "STRING",
			"Gender": "STRING",
			"FirstName": "STRING",
			"LastName": "STRING"
			}
		},
		"fields": {
			"ID": "CU00048376",
			"Gender": "M.",
			"FirstName": "Benjamin",
			"LastName": "Verret"
			}
		}
	}
]

For more examples see the REST API Cookbook, and Working with JSON data in the Workflow Online Help.