JSON
The JSON document is a single object, whose entry member holds the entry
point and whose table member holds the array of the structures:
{
"entry": {
"smbios-version": "3.4"
},
"table": [
{
"handle": 10,
"type": 7,
"length": 39,
"level": "3.1",
"state": [
"decoded"
],
"description": "Cache information",
"attributes": {
"socket-designator": "L1 - Cache",
"level": 1,
"socketed": false,
"mode": "write-back",
"installed-size": 1310720,
"supported-sram": {
"burst": false,
"pipeline-burst": true
},
"speed": 1,
"associativity": "8-way"
}
}
]
}
A structure which is not decoded holds its raw bytes instead of the attributes:
{
"handle": 5,
"type": 11,
"length": 21,
"level": "2.0",
"state": [
"decoded"
],
"description": "OEM strings",
"data": "CwUFAAE=",
"strings": [
"Default string"
]
}
1. Values
Values are written the same way as in YAML, so that a JSON document and a YAML one, loaded by their readers, hold the same data:
-
Handles, types, lengths, the identifiers of the properties, the indexes and the offsets of the additional information entries and the values of the numeric attributes, i.e. integers, fixed-point numbers, sizes, addresses and handles, are numbers. JSON has no hexadecimal numbers, so the ones the other formats write in hexadecimal are written as decimal ones, e.g.
10for the handle0x000a. -
Booleans are
trueorfalse, and so are the flags of the sets. The codes a boolean attribute may give to its states instead are strings. -
Other values, e.g. strings, codes of the enumerations, versions, dates, UUIDs and the string
unknown, are strings. -
Values which are not specified are
null. -
With
--pretty, every value of an attribute is a string.
Numbers are written with all their digits, and sizes and addresses may take 64 bits, which is more than the readers keeping the numbers as floating-point ones, e.g. the ones of JavaScript, hold exactly.
A string which is not valid UTF-8, which the firmware may hold, has the bytes
which are not valid replaced by the replacement character, U+FFFD, since JSON
has no strings of other encodings. The raw strings of a structure are written
this way too, and its raw bytes, data, as a Base64 string.
2. Structures
The header of a structure gives every member described in
Exported documents, and
level is null for the structures which have no versions.
properties and overlays are arrays of objects of the members the
properties and the entries have, which are all present, with null for the
ones which have no value. strings is an array of the strings.
3. Schema
The document is described by a JSON Schema,
https://opendmi.org/schemas/opendmi.json:
$ opendmi export -f json -o smbios.json
$ check-jsonschema --schemafile opendmi.json smbios.json