Default UDT type conversion
Default UDT type conversion to JSON
Default UDT type conversion to JSON
JSON strings are enclosed in quotation marks.
They can be any length, but JSON parsers can typically parse strings that are up to 1MB in length.
JSON Boolean values
JSON dates and times
JSON numbers
S7 IEC data types
The Table 1, “Siemens S7 IEC data types to a default format in JSON” maps Siemens S7 IEC data types to a default format in JSON.
S7 data type | JSON type | JSON format | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
BOOL | Boolean |
| ||||||||
BYTE | Integer |
| ||||||||
WORD | Integer |
| ||||||||
DWORD | Integer |
| ||||||||
INT | Integer |
| ||||||||
DINT | Integer |
| ||||||||
REAL | Integer |
| ||||||||
S5TIME (duration) | String |
| ||||||||
TIME (duration) | String |
| ||||||||
DATE | String | YYYY-MM-DD — for example, | ||||||||
TIME_OF_DAY | String | hh:mm:ss.sss — for example, | ||||||||
CHAR | String |
| ||||||||
Nested Arrays | Array of arrays | { "myArray": [ [1,2,3], [4,5,6] ] } | ||||||||
Array of Values | Array of values | { "array1": [ 1,2,3 ], "array2": [ "A","B","C" ], "array3": [ "A",1, "B",2, "C",3 ] } | ||||||||
Array of Objects | Array of objects | { "myArray": [ { "Label": "height", "Value": 1} ] } |
Note
All of the types listed in Table 1, “Siemens S7 IEC data types to a default format in JSON” have been tested extensively except S5TIME (duration), TIME (duration), DATE, and TIME_OF_DAY. These four types are also supported, but they have not been tested.