---
title: "JSON Database + Relational = Better Together"
publish_date: 2018-02-05
updated_date: 2022-09-08
author: "MariaDB"
channel:
  - name: "Developer"
    url: "/resources/blog/channel/developer.md"
tags:
  - name: "developers"
    url: "/resources/blog/tag/developers.md"
  - name: "hybrid data"
    url: "/resources/blog/tag/hybrid-data.md"
  - name: "IoT services"
    url: "/resources/blog/tag/iot-services.md"
  - name: "JSON"
    url: "/resources/blog/tag/json.md"
  - name: "JSON database"
    url: "/resources/blog/tag/json-database.md"
  - name: "NoSQL"
    url: "/resources/blog/tag/nosql.md"
  - name: "Platform"
    url: "/resources/blog/tag/platform.md"
  - name: "Relational + JSON"
    url: "/resources/blog/tag/relational-json.md"
---

# JSON Database + Relational = Better Together

JSON is the de facto standard for consuming and producing data via web, mobile and IoT services. JSON provides developers with a great deal of simplicity and flexibility, and in some cases it may be more practical to store data as JSON documents in a database.

JSON documents required a NoSQL database in the past – a document database to be specific. However, NoSQL databases sacrificed transactions, data integrity and reliability (and a powerful query language) in order to deliver greater simplicity and flexibility.

That was then. This is now. You can use a relational database for [JSON documents](https://staging-mdb.com/database/topics/json), and you no longer have to choose between relational and JSON. You can create hybrid data models comprised of structured and semi-structured data, and enjoy the benefits of JSON without sacrificing the advantages of a relational database (e.g., transactions and SQL).

[MariaDB Enterprise](https://staging-mdb.com/products/enterprise/) includes SQL functions for creating and querying JSON documents. You can not only extend relational data with JSON documents; you can create JSON documents from rows or create rows from JSON documents. It’s up to you.

Let’s consider a couple of e-commerce examples. The first involves product catalogs where every product has a name and price, yet different product types may have different attributes. You could create a separate table for every product type, but that’s not very flexible. It would be a lot easier to create a single table with columns for name (VARCHAR) and price (DECIMAL), and a separate column for attributes (JSON). A second example involves shopping carts where purchases may be stored as structured data with a fixed schema, but shopping carts can be stored as semi-structured with JSON documents. Using MariaDB Platform, you can join customer profiles to purchases and/or shopping carts regardless of the format!

By introducing SQL functions for JSON, developers can now use a single database for both structured and semi-structured data – and administrators don’t have to worry about losing transactions, data integrity and reliability. It’s the best of both worlds!

**Want to learn more?**

- Watch this on-demand webinar, [JSON + relational: How to use hybrid data models](https://go.mariadb.com/JSON-Relational-How-to-use-hybrid-data-models-2019-11-12.html), which includes a demonstration of a web application built with ReactJS and NodeJS (with [downloadable code](https://github.com/mariadb-corporation/Developer-Examples?mkt_tok=eyJpIjoiTVdZeFl6ZzBaVGMwT1dNNSIsInQiOiJFcnVYR2RmdXBLTVBoeUsrSjJ2a2wzV3pQWmk4Wkd2TklIVG9IRDJRQ3I5bXBwMEluTXEzTWszN2xEam9MUmFMVUdRaHFveHJvZms0T3J4NXFlMGVsTkpxT3p6WWxYUElJNVhhaVJpaFZ1UzdTMWYwMUtBcGtyOFVZWHF2VjM1TCJ9)).
- [Top 5 reasons to use relational + JSON](https://staging-mdb.com/database-topics/semi-structured-data/)