Skip to main content
Building blocks - JSON 101

This article is designed to help you grasp the fundamentals of JSON, enabling you to work more efficiently in Tines.

Angela Ruhstorfer avatar
Written by Angela Ruhstorfer
Updated over 3 weeks ago

Overview

JSON (JavaScript Object Notation) is a text format and, in relation to Tines, is used in API calls to send and receive information. Think of APIs as a way for two systems to talk to each other. As a real-life example, a restaurant waiter (API) takes your order (Client) and sends your order to the kitchen (Server). JSON is the format used to make this communication clear and simple. In this article, we'll look over basic JSON structures, data types, and when to use them.

Tines references

Before getting started, we recommend familiarizing yourself with the surrounding functionality this article covers:

Make it happen

JSON data types

Boolean

A boolean represents one of two possible values: true or false, and are used to represent binary choices or logical states. Boolean values are not wrapped in quotes. Think of a boolean as the answer to a yes or no question.

Example:

{
"isAvailable": true,
"isAdmin": false
}

Null

The null value represents the intentional absence of a value or unknown value. Null values are not wrapped in quotes.

Example:

{
"firstName": "Angie",
"nickname": null
}

Number

A number represents numeric values, including both integers (whole numbers) and floating-point numbers (numbers with a decimal point). Number values are not wrapped in quotes.

Example:

{
"score": 89,
"price": 19.99
}

String

A string is a sequence of characters enclosed in double quotes ("). Strings are used to represent text-based data, such as names, messages, or any value that needs to be treated as text.

Example:

{
"company": "Tines",
"mission": "To power the world’s most important workflows!"
}

JSON structures

Arrays

An array is used to represent an ordered collection of values. Arrays are enclosed in square brackets ([]). Arrays can hold data in an ordered structure, making them suitable for lists and datasets of similar entities/values or when in need of an ordered collection.

Array example:

[1, 2, 3, 4, 5]

Array of objects example: This structure is useful when you have a collection of similar entities (e.g., a list of people or products).

[
{
"name": "Angie",
"city": "Los Angeles"
},
{
"name": "Yanni",
"city": "Seattle"
}
]

Key-Value pairs

A key-value pair consists of a key and a value. The key is always a string enclosed in double quotes ("), and the value can be any valid JSON data type: string, number, boolean, array, object, or null. The key and value must be separated by a colon (:). Multiple key-value pairs in an object are separated by commas.

Single key-value pair example:

{
"name": "Tines"
}

Multi key-value pairs example:

{
"name": "Tines",
"isAwesome": true,
"hobbies": ["building", "workflows"],
"address": {
"city": "Dublin",
"zip": "D02"
}
}

Objects

An object represents a collection of key-value pairs. It is enclosed in curly braces ({}), where each key is a string and is followed by its corresponding value. Objects are useful when you need unique identifiers for each element.

Single object example:

{
"name": "Tines"
}

Multi-object example:

{
"flower1": {
"name": "Rose",
"color": "Red",
"type": "Perennial"
},
"flower2": {
"name": "Tulip",
"color": "Yellow",
"type": "Perennial"
}
}

Object of array example: This structure is useful when you want to group related data by categories or keys.

{
"fruits": ["apple", "banana", "cherry"],
"colors": ["red", "green", "blue"]
}
Did this answer your question?