---
title: "Get started using MariaDB JSON capabilities in under 2 minutes"
publish_date: 2022-02-24
updated_date: 2022-03-01
author: "Rob Hedgpeth"
channel:
  - name: "Developer"
    url: "/resources/blog/channel/developer.md"
tags:
  - name: "JSON"
    url: "/resources/blog/tag/json.md"
---

# Get started using MariaDB JSON capabilities in under 2 minutes

Previously, I wrote [an article](https://staging-mdb.com/resources/blog/using-json-in-mariadb/) introducing you to the idea of using [JavaScript Object Notation (JSON)](https://www.json.org/) formatted data, completely free and out-of-the-box, with MariaDB, and *why* that’s so useful.

![Externally-described relational table vs self-described JSON table](https://staging-mdb.com/wp-content/uploads/2022/02/json-mariadb-blog-img1.png)

The gist was that the ability to combine the traditional structured data of a relational database with the flexibility of semi-structured JSON data provides an extremely powerful approach to solving a lot of problems presented by modern applications.

![Table with structured and semi-structured data](https://staging-mdb.com/wp-content/uploads/2022/02/json-mariadb-blog-img4.png)

And it’s at this point that you’re probably wondering *what’s the easiest way to get started using JSON within a MariaDB database*? Fear not, I’ve got just what you need!

### Up and Running with MariaDB and Docker

Like you, I get that sometimes it’s just easier to understand something by diving directly into it. That’s why I’ve created a [new repository](https://github.com/mariadb-developers/mariadb-json-quickstart) that will get you up and running with MariaDB JSON functionality in a matter of minutes.

Through the use of [containerization](https://www.docker.com/resources/what-container) comes the ability to spin up a MariaDB database and pre-load it with sample JSON, allowing you to go from nothing to querying in only a few minutes. In fact, the “MariaDB JSON Quickstart” repository accomplishes this using only two files.

The first is a [Docker Compose file](https://docs.docker.com/compose/). Docker Compose files provide a way to document and configure all of the application’s service dependencies, which includes things like databases, queues, caches, web service APIs, etc. Then, using the Docker Compose command line tool, you can create and start one or more containers for each dependency with a single command (`docker-compose up`).

The Compose file included in the repository, named `docker-compose.yml`, consists of the following:

```
version: "3"
services:
  mariadb:
    image: mariadb:latest
    container_name: mdb_json
    ports: 
      - 3306:3306
    volumes:
      - ./data:/docker-entrypoint-initdb.d
    environment: 
      MARIADB_ROOT_PASSWORD: 'Password123!'
```

As you can see, the Compose file is pretty simple. First, it’s going to spin up a new Docker container from the latest version of the [official MariaDB Docker image](https://hub.docker.com/_/mariadb). The file also includes configuration for the exposed ports (both internally and externally for the Docker container) as well as setting the password for the `root` user.

You’ll also notice the configuration property `volume`. [Volumes](https://docs.docker.com/storage/volumes/) are the preferred mechanism for persisting data generated by and used by Docker containers.

TL;DR – I’ve used the volume property to target a [SQL script file](https://github.com/mariadb-developers/mariadb-json-quickstart/tree/main/data) to create a new database and table and load the table with data.

But, by all means, don’t take my word for it. Check out the [MariaDB JSON Quickstart repository](https://github.com/mariadb-developers/mariadb-json-quickstart) for yourself!

### Learn more

If you’d like to learn even more about what’s possible with JSON and MariaDB, or about the many other MariaDB features and capabilities, be sure to check out the [Developer Hub](https://staging-mdb.com/developers/) and our new [Developer Code Central GitHub organization](https://github.com/mariadb-developers).

You can also dive even deeper into MariaDB capabilities in the [official documentation](https://staging-mdb.com/docs/).

And, as always, we’d be nothing without our awesome community! If you’d like to help contribute you can find us on [GitHub](https://github.com/mariadb-corporation), send feedback directly to us at <developers@mariadb.com>, or join the conversation in the new [MariaDB Community Slack](https://r.mariadb.com/join-community-slack)!