NMONVisualizer can process JSON files, but they must be in the correct format. This format consists of 3 main objects: the metadata, the data type definitions and the actual data. These objects are defined as fields of the main JSON object, so they can be placed in the file in any order.
The metadata section contains information about the JSON file being parsed. The following fields are required:
The system name as a string. This can be the short name or the fully qualified domain name.
A timestamp pattern as defined by Java's SimpleDateFormat class. This string may contain a time zone pattern (z, Z or X [Java 7 only]).
Two other fields are optional:
Either a string or a number. As a string, the value must return a valid value when used in a call to TimeZone.getTimeZone() in Java. As a number, the value will be interpreted as the number of hours offset from UTC (either positive or negative).
An object containing key value pairs as strings. These will be placed directly into the parsed data as metadata. These values can be viewed in the GUI by right clicking on the dataset and selecting Parsed File Info.
Note that whenPattern may include a time zone. If it does not and no timezone is specified, then the file will be parsed using the current timezone.
This section defines the names and fields that will be used in the data section. A single array of objects, named types is used to define this data. Each array entry (type) is an object containing the following:
A short string used to uniquely identify the type within the data set. This can be the same as the name if it is unique.
A string used to descriptively name the type. This is the string that will be displayed in the GUI.
An array of strings denoting the fields, or values, defined by this type.
Optionally, a subtypes array can be specified to indicate that the data type has subbordinate types. This allows similar data to be grouped together in the GUI. For example, all disks will have the same fields, but each disk could be named and displayed separately. subtypes should be an array of strings.
The data section contains the actual data. A single array named data contains all the values. Each element of the array contains all the data for a given time and contains the following fields:
The datetime for the data record. This value must be a string formatted as defined by whenPattern.
For each type, either of the following:
- For basic types, an array of numbers containing the data for each type. The name of this array must be the name of a valid data type.
- For subtypes, an map (JSON object) containing an array for each subtype. The name of each array must be the name of a valid subtype.
If data for a particular (sub)type does not exist for a particular when value, it can be skipped; null or empty arrays should not be used. However, if data for a particular field does not exist but other fields are present at that time, null should be used as the value. This will be interpreted as Double.NaN by the GUI (i.e. a missing value).
- optional timezone
types, an array of objects
- fields, an array of strings
- subtypes, an array of strings
data, an array of objects, one for each time
- when, formatted using whenPattern
for each type, either
- an array of numbers for each type
- an object for each type with subtypes; for each subtype, an array of numbers