- Home
- API Design
- How to use JSON Data Types?

A JSON body can comprise one of 6 data types which can be categorized as primitive or complex data types.
In JSON, keys must always be strings. Any string is always written in double quotes.
{
"name": "apitier"
}The number represents the numeric characters. Number values must be integer or floating-point numbers. A floating-point number is a number with a decimal point value such as; 0, 3.11, 7.3, and -109.5.
{
"age": 50
}{
"percentage": 80.55
}It is a set of name or value pairs inserted between {} (curly braces). The keys must be strings and should be unique and multiple keys and value pairs are separated by a, (comma).
{ key : value, .......}
{
"user": {
"name": "apitier",
"age": 50,
"percentage": 60.05
}
}The array is a list of objects, which are mainly enclosed in square brackets [ ]. In JSON, the array value can be a string, number, object, array, boolean or null.
[ value, .......]
{
"apitier": [
"postcode",
"address",
"post_town"
]
}
{
"addresses": [
{
"line_1": "House Of Commons",
"line_2": "Houses Of Parliament",
"line_3": "",
"post_town": "LONDON",
"postcode": "SW1A 0AA",
"address": "House Of Commons, Houses Of Parliament, LONDON, SW1A 0AA"
}
]
}This data type can be either true or false.
{
"result" : true
}It is just a defined nullable value(empty value).
{
"result" : true,
"grade" : null,
"no" : 210
}