How To Write JSON (for Non-Programmers)

If you’re playing around with Marketing Automation, you will no doubt come across JSON.

Tools often use this to talk to each other.

Luckily, it’s rather easy to understand & write.

(I’m also not a programmer)

By the end of this guide, you’ll know exactly how JSON works.

Let’s dive in!

What is JSON

JSON stands for JavaScript Objection Notation.

What does that mean? It’s basically a simple, readable format for structuring data.

It’s used to transmit data between a server and a web application.

So if you, for example, want to send data from ManyChat to ActiveCampaign, you’ll need JSON to do that.

There are also tools like Make & Zapier that allow you to make these connections without having to write any JSON.

That’s because they basically write the JSON for you.

So if you’re not a programmer (like me), I would highly recommend using a tool like that.

But it’s still handy to know some basics.

That’s what this guide is for 🙂

Writing simple JSON

Take a look at the example below.

{
"first.name" : "Max",
"last.name" : "van Collenburg"
}

Let me explain how this works.

To start the JSON code, we always use a curly bracket ({ ).

{

Then we want to add the name of the value by surrounding it by quote marks ( ” ).

They call this a key.

{
"first.name"

Then we add the value of the key by adding a colon ( : ) and then the value surrounded by quote marks ( ” ).

{
"first.name" : "Max"

Together, they make a key/value pair.

And that’s basically the two main parts that make up JSON.

Now, we want to add a second key/value pair.

We do that by adding a comma ( , ) and then a new row.

{
"first.name" : "Max",
"last.name" : "van Collenburg"

And then, we add a curly bracket ( } ) to close the JSON.

Note that we never use a comma after the last value.

{
"first.name" : "Max",
"last.name" : "van Collenburg"
}

That’s it! You now know how to write simple JSON! 🙌

Let’s dive a bit deeper.

We’ll talk about arrays next.

How to use Arrays

Okay, I can hear you thinking.

You’re probably thinking, what the heck is an array?

Well, it’s basically a list of values.

The format looks like [ , , , ]

So if you would put some values in there, it would look like [18, 24, 33]

Let me show you an example:

{
"first.name" : "Max",
"last.name" : "van Collenburg",
"purchased.products" : [18, 24, 33]
}

The first part you already know.

But we now added purchased.products.

And the array behind it, the list, shows us that Max van Collenburg bought product 18, 24, and 33.

(these numbers stand for the ids of the products)

Cool, right?

Now we’re getting somewhere.

Up next, we’ll cover objects.

How to use Objects

Okay, now it’s getting more complicated.

An object is a bit similar to an array, but this time instead of a simple list with comma-separated-values, we use key/value pairs.

The format looks like this: { ” “: ” ” }

So an example could be {“processor”: “paypal”,”amount”: “239.59”}

Here’s an example of what that looks like:

{
"first.name" : "Max",
"last.name" : "van Collenburg",
"purchased.products" : [18, 24, 33],
"payment" : { "processor": "paypal", "amount": "239.59", "currency": "USD" }
}

So the payment object tells us that $239.59 was paid with PayPal.

Validating JSON

JSON can be a bit intimidating because if you place one comma wrong, the whole thing doesn’t work.

That’s why you should always validate your JSON to make sure it’s working.

I’m using a simple free tool called JSON Blob for this.

Paste your JSON in there, and it will show you a nice overview of the JSON & if anything is wrong.

The JSON we just wrote looks like this:

Validate & preview your JSON in JSON Blob

Handy, right? 😄

Over to you

That’s it!

You now know the fundamentals of writing JSON.

If you want, you can go even crazier by objects in objects in objects.

Or nesting arrays inside objects in objects.

But I’ll let that over to someone who actually knows what he’s talking about, haha 😅

(and my guess is, you probably won’t need it)

.

Now I would like to hear from you.

Did this help you to understand JSON?

Or do you maybe still have any questions about writing JSON?

Whatever it is, let me know in the comments below.

Become a Make expert fast 🚀

Make is awesome but it takes a while to get the hang of it. Get my best tips to get the most out of Make in no-time.

    Max van Collenburg

    I'm addicted to travel, love a good cappuccino, have two cute cats, and I help solopreneurs who work from home to get a bit more productive. More weird facts about me here.

    Leave a Comment