Data Types
Learn about usage and manipulation of data types in TonCut for Automation.
Time
The time unit can take the following values:
"s"
for seconds,"m"
for minutes,"h"
for hours and"d"
for days.
It can be changed by setting the time
property in the defaultUnits
JSON object.
The default time unit is used only if the value does not specify the unit.
So, if the default unit is set to minutes "m"
, and you specify { "value": 5.5 }
,
then it will be treated as 5.5 minutes.
However, you can still force the unit in the value by setting it as a string: { "value": "5.5s" }
.
In this case, the value will be treated as 5.5 seconds, regardless of the default time unit.
The default time unit is a second "s"
.
Changing default time unit
Percent
It doesn’t matter if you specify a percentage value as 50 or "50%" - it will always be treated as 50%.
To be consistent, we have the percent
property in the defaultUnits
JSON object, but it should always be set to "%"
.
The percent unit can take only one value: "%"
, which is also the default.
Setting percent property to "%"
Length
The length unit can take the following values:
"mm"
for millimeters,"cm"
for centimeters and"in"
for inches.
Default length unit can be changed by setting the length
property in the defaultUnits
JSON object.
The default length unit is a millimeter "mm"
.
Setting length property to "cm"
Field
The field unit can take the following values:
"sqmm"
for square millimeters,"sqcm"
for square centimeters,"sqm"
for square meters,"sqin"
for square inches and"sqft"
for square feet.
It can be changed by setting the field
property in the defaultUnits
JSON object.
The default field unit is used only if the value does not specify the unit.
So, if the default unit is set to square meters "sqm"
, and you specify { "value": 250 }
,
then it will be treated as 250 square meters (250m2).
However, you can still force the unit in the value by setting it as a string: { "value": "250sqmm" }
.
In this case, the value will be treated as 250 square millimeters (250mm2), regardless of the default field unit.
The default field unit is a square millimeter "sqmm"
.
Setting field property to "sqm"
Angle
The angle unit can take the following values:
"rad"
for radians,"deg"
for degrees.
Default angle unit can be changed by setting the angle
property in the defaultUnits
JSON object.
The default angle unit is used only if the value does not specify the unit.
So, if the default unit is set to degrees "deg"
, and you specify { "value": 0.5 }
,
then it will be treated as 0.5 degrees (0.5°).
However, you can still force the unit in the value by setting it as a string: { "value": "0.5rad" }
.
In this case, the value will be treated as 0.5 radians, regardless of the default angle unit.
The default angle unit is radian "rad"
.
Setting angle property to "deg"
Enum
The enum
type is a value type that defines a set of named constants.
In this documentation, enum
types are specified using the format: enum(value1, value2, value3)
Only one of the specified values can be used, for example:
In our JSON, enum types are represented as strings.
Set
The set
type is similar to the enum
type, with the exception that it allows for the assignment of multiple values.
Like the enum
type, it defines a set of named constants. In this documentation, set
types are specified using the format:
set(value1, value2, value3)
Any combination of the specified values can be used, for example:
As shown in the example above, all values are contained within a JSON array.
In our JSON, set types are represented as arrays containing strings.
Date
The date type represents date and time.
JSON format does not support date format so we are using ISO 8601 format.