Base JSON types#
This covers the base types that are part of the JSON specification.
TheoTown's JSON parser is fault tolerant, henceforth it can treat values provided in a string format as some other type. However, there are cases where it can create ambiguities due to an attribute accepting different types of values. Therefore, you are recommended to not rely on TheoTown's JSON parser to always treat your string type values as some other type.
TheoTown's JSON parser also silently ignores attributes (keys) that a specific draft doesn't support.
Boolean#
Booleans refer to truthy values. They can have 2 values: either true
or false
.
{
"auto build": false, // whether a building should be auto built
"draw ground": true // whether to draw ground under the building where transparent
}
Integer#
Integers refer to numeric, integer values.
{
"price": 5000, // price of a building
"build time": 46 // amount of days it takes to build a building
}
Float#
Floats (floating-point numbers) refer to rational numbers.
String#
Strings refer to text values. These values have to be enclosed in quotation marks.
Examples of such include:
To add a new line in the string, you would use an escape sequence,
in this case, \n
.
Array#
Arrays are used for providing multiple values for an attribute.
Object#
Objects are used for providing attributes for an attribute. Most of the attribute types covered in this documentation section are considered objects. A simple plugin begins with an array that contains a draft object with its specific draft attributes.