What is JSON?
Let’s start with the basics: JSON stands for JavaScript Object Notation.
You don’t need to know JavaScript to use it. JSON is simply a way of storing and sending information in a format that both people and computers can understand.
Think of JSON as the common language of technologies. When Tines actions share information across events, they do it in JSON, making it easy to organize and reference data as it moves through a story.
Example
When you fill out a contact form on a website, you may type in your name and email address. Behind the scenes, that information might look like this:
{
"name": "Jordan Smith",
"email": "jordan.smith@company.com"
}That’s JSON! It’s structured, predictable, and easy for both Tines and other systems to work with.
JSON data types and structures
When you peek behind the scenes in Tines, you’ll notice that much of the data formatting happens in JSON. Let’s break down the core components!
Key-value pairs
At the heart of every JSON structure is the key-value pair. Think of a key as a label, and the value as the information tied to that label.
For example:
"username": "tino"usernameis the key: It names the pieces of information.tinois the value: The actual information tied to that key.
Everything in JSON is built from these simple building blocks.
Data types: What kind of value is this?
Values in JSON can take on different kinds of information you’re storing. Here are the main ones you’ll see:
Organize JSON data with objects and arrays
Once you know key-value pairs and data types, you can combine them into bigger structures to further organize your data: { }
🪄Tip
Put it all together
Let's take a look at some JSON data that combines all of these concepts. Here's a JSON object that contains information on a training course and its students:
{
"training_course": {
"name": "Early Automators",
"is_active": true,
"students": [
{
"id": 1,
"email": "jane@tinesuniversity.io"
},
{
"id": 2,
"email": "joe@tinesuniversity.io"
}
]
}
}The breakdown of each element:
training_course: An object holding all of the details. This object establishes the organization of the training course data presented.name: A key with string value. This represents the name of the training course.is_active: A key with a boolean value. This represents the status of the training course ("is it actively being offered or not?").students: An array of objects detailing student information. This represents the list of students currently enrolled in the training course.id: A key with a number value. This represents the ID of each student enrolled in the training course.email: A key with a string value. This represents the email address of each student enrolled in the training course.