{"id":11976,"date":"2023-10-30T06:35:13","date_gmt":"2023-10-30T13:35:13","guid":{"rendered":"https:\/\/www.mysqltutorial.org\/?page_id=11976"},"modified":"2023-11-05T23:56:35","modified_gmt":"2023-11-06T06:56:35","slug":"mysql-json-data-type","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-data-type\/","title":{"rendered":"MySQL JSON Data Type"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to use MySQL JSON data type to store JSON documents in the database.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is JSON<\/h2>\n\n\n\n<p>JSON stands for &#8220;JavaScript Object Notation&#8221;. JSON is a lightweight data-interchange format that is easy for humans to read and write and simple for computers to parse and generate. <\/p>\n\n\n\n<p>JSON is built on two data structures: <strong>objects <\/strong>and <strong>arrays<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Objects <\/h3>\n\n\n\n<p>An object is an unordered collection of key-value pairs enclosed in curly braces <code>{}<\/code>. Each key is a string, followed by a colon (<code>:<\/code>), and then the associated value. For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JSON \/ JSON with Comments\" data-shcb-language-slug=\"json\"><span><code class=\"hljs language-json\">{\n    <span class=\"hljs-attr\">\"name\"<\/span>: <span class=\"hljs-string\">\"John Doe\"<\/span>,\n    <span class=\"hljs-attr\">\"age\"<\/span>: <span class=\"hljs-number\">22<\/span>\n}  <\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JSON \/ JSON with Comments<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">json<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"note\">Note that you must enclose the key in a JSON document with double quotes (<code>\"<\/code>).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Arrays<\/h3>\n\n\n\n<p>An array is an ordered list of values closed in square brackets <code>[]<\/code>. An array may contain values of any valid JSON data type, including objects and other arrays. For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JSON \/ JSON with Comments\" data-shcb-language-slug=\"json\"><span><code class=\"hljs language-json\">&#91;<span class=\"hljs-string\">\"John Doe\"<\/span>, <span class=\"hljs-number\">22<\/span>]<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JSON \/ JSON with Comments<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">json<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, we have a JSON array of two values that represent the name and age of a person.<\/p>\n\n\n\n<p>JSON supports several data types, including:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>String: &#8220;JSON&#8221;<\/li>\n\n\n\n<li>Number: 10, 12.25<\/li>\n\n\n\n<li>Boolean: true and false.<\/li>\n\n\n\n<li>Null: null<\/li>\n<\/ul>\n\n\n\n<p>In practice, you use JSON in web development for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Configuration files <\/li>\n\n\n\n<li>Data exchange between a client and a server<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to MySQL JSON data type<\/h2>\n\n\n\n<p>MySQL supports the native JSON data type defined by&nbsp;<a href=\"https:\/\/tools.ietf.org\/html\/rfc7159\" target=\"_blank\" rel=\"noreferrer noopener\">RFC 7159<\/a>&nbsp; starting in version 5.7.8. The native JSON data type offers the following advantages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>MySQL validates the JSON documents stored in the JSON column and issues an error if they are invalid.<\/li>\n\n\n\n<li>MySQL stores the JSON documents in a binary format optimized for quick searches.<\/li>\n<\/ul>\n\n\n\n<p>MySQL uses roughly the same storage for JSON documents as for LONGBLOG or LONGTEXT data.<\/p>\n\n\n\n<p>The following shows how to define a table column with the JSON data type:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">column_name JSON<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The JSON column can store NULL values. Also, starting from MySQL 8.0.13, a JSON column can accept a default value.<\/p>\n\n\n\n<p>It is not possible to directly index a JSON column. Instead, you can use a <a href=\"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-functional-index\/\">functional index<\/a> to <a href=\"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-create-index\/\">create an index<\/a> on values extracted from the JSON column. <\/p>\n\n\n\n<p>When <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-select-from\/\">querying data<\/a> from a JSON column, the MySQL optimizer will search for functional indexes to match the JSON expressions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">MySQL JSON data type example<\/h2>\n\n\n\n<p>We&#8217;ll take an example of using the JSON data type.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1) Creating a table with a JSON column<\/h3>\n\n\n\n<p>The following statement <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-create-table\/\">creates a new table<\/a> called <code>products<\/code> with a JSON column:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> products(\n   <span class=\"hljs-keyword\">id<\/span> <span class=\"hljs-built_in\">INT<\/span> AUTO_INCREMENT PRIMARY <span class=\"hljs-keyword\">KEY<\/span>,\n   <span class=\"hljs-keyword\">name<\/span> <span class=\"hljs-built_in\">VARCHAR<\/span>(<span class=\"hljs-number\">255<\/span>) <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-literal\">NULL<\/span>,\n   price <span class=\"hljs-built_in\">DECIMAL<\/span>(<span class=\"hljs-number\">10<\/span>,<span class=\"hljs-number\">2<\/span>) <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-literal\">NULL<\/span>,\n   properties <span class=\"hljs-keyword\">JSON<\/span>\n);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>products<\/code> table has four columns:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>id<\/code>: This is an <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-auto_increment\/\">auto-increment<\/a> <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-primary-key\/\">primary key column<\/a> that uniquely identifies a product.<\/li>\n\n\n\n<li><code>name<\/code>: This column stores the name of the product.<\/li>\n\n\n\n<li><code>price<\/code>: This column stores the price of the product.<\/li>\n\n\n\n<li><code>properties<\/code>: This column stores the properties of the product such as colors and sizes.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2) Inserting JSON data into the table<\/h3>\n\n\n\n<p>The following statement inserts a new row with JSON data into the <code>products<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span> products(<span class=\"hljs-keyword\">name<\/span>, price, properties)\n<span class=\"hljs-keyword\">VALUES<\/span>(<span class=\"hljs-string\">'T-Shirt'<\/span>, <span class=\"hljs-number\">25.99<\/span>, <span class=\"hljs-string\">'{\"sizes\":&#91;\"S\",\"M\",\"L\",\"XL\"], \"colors\": &#91;\"white\",\"black\"]}'<\/span>);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, we inserted a new row into the <code>products<\/code> table. The value of the <code>properties<\/code> column is a JSON document with the following format:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"JSON \/ JSON with Comments\" data-shcb-language-slug=\"json\"><span><code class=\"hljs language-json\">{<span class=\"hljs-attr\">\"sizes\"<\/span>:&#91;<span class=\"hljs-string\">\"S\"<\/span>,<span class=\"hljs-string\">\"M\"<\/span>,<span class=\"hljs-string\">\"L\"<\/span>,<span class=\"hljs-string\">\"XL\"<\/span>],<span class=\"hljs-attr\">\"colors\"<\/span>:&#91;<span class=\"hljs-string\">\"white\"<\/span>,<span class=\"hljs-string\">\"black\"<\/span>]}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JSON \/ JSON with Comments<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">json<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>And we place the JSON document inside a single quote (&#8216;). <\/p>\n\n\n\n<p>When the statement executes, MySQL performs the following steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, validate the JSON document for validity.<\/li>\n\n\n\n<li>Second, convert the JSON string into binary format and store it in the JSON column.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3) Querying JSON data from the table<\/h3>\n\n\n\n<p>The following query retrieves data from the <code>products<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> <span class=\"hljs-keyword\">name<\/span>, properties \n<span class=\"hljs-keyword\">FROM<\/span> products;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\">+---------+----------------------------------------------------------------+\n| name    | properties                                                     |\n+---------+----------------------------------------------------------------+\n| T-Shirt | {\"sizes\": &#91;\"S\", \"M\", \"L\", \"XL\"], \"colors\": &#91;\"white\", \"black\"]} |\n+---------+----------------------------------------------------------------+\n1 row in set (0.00 sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If the output is difficult to read, you can use the <code>JSON_PRETTY()<\/code> function to format it.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> JSON_PRETTY(properties)\n<span class=\"hljs-keyword\">FROM<\/span> products;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\">+------------------------------------------------------------------------------------------------------+\n| JSON_PRETTY(properties)                                                                              |\n+------------------------------------------------------------------------------------------------------+\n| {\n  \"sizes\": &#91;\n    \"S\",\n    \"M\",\n    \"L\",\n    \"XL\"\n  ],\n  \"colors\": &#91;\n    \"white\",\n    \"black\"\n  ]\n} |\n+------------------------------------------------------------------------------------------------------+\n1 row in set (0.00 sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\">4) Getting the keys of a JSON document<\/h3>\n\n\n\n<p>The following uses the <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json_keys\/\">JSON_KEYS()<\/a><\/code> function to list all the keys of the JSON document:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> JSON_KEYS(properties)\n<span class=\"hljs-keyword\">FROM<\/span> products;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\">+-----------------------+\n| JSON_KEYS(properties) |\n+-----------------------+\n| &#91;\"sizes\", \"colors\"]   |\n+-----------------------+\n1 row in set (0.01 sec)\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, we use the <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json_keys\/\">JSON_KEYS()<\/a><\/code> function to get all the keys of the JSON document stored in the <code>properties<\/code> column. <\/p>\n\n\n\n<p>The function returns a JSON array containing all the keys of the JSON document.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5) Extracting data from a JSON document<\/h3>\n\n\n\n<p>To specify a location within a JSON document, you use a <a href=\"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-path\/\">JSON path expression<\/a>. A path expression allows you to navigate through the structure of a JSON document to access specific data.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the dollar sign (<code>$<\/code>) to represent the current document.<\/li>\n\n\n\n<li>Use a key or array index to specify the exact location.<\/li>\n<\/ul>\n\n\n\n<p>For example, to get the first colors of the product, you use the following path:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">$.colors&#91;0]<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>To extract the first color from the JSON document with the above path, you use the <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json_extract\/\">JSON_EXTRACT()<\/a><\/code> function. For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> JSON_EXTRACT(properties, <span class=\"hljs-string\">\"$.colors&#91;0]\"<\/span>)\n<span class=\"hljs-keyword\">FROM<\/span> products;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-15\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\">+-----------------------------------------+\n| JSON_EXTRACT(properties, \"$.colors&#91;0]\") |\n+-----------------------------------------+\n| \"white\"                                 |\n+-----------------------------------------+\n1 row in set (0.00 sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-15\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>MySQL supports native JSON data types starting in version 5.7.8.<\/li>\n\n\n\n<li>MySQL stores JSON in a binary format optimized for quick searches.<\/li>\n\n\n\n<li>Use the <code>JSON_PRETTY()<\/code> function to format the JSON documents.<\/li>\n\n\n\n<li>Use the <code>JSON_KEY()<\/code> function to get all keys of a JSON document.<\/li>\n\n\n\n<li>Use the <code>JSON_EXTRACT()<\/code> function to extract data from a JSON document.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful? <\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"11976\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-data-type\/\"\n\t\t\t\tdata-post-title=\"MySQL JSON Data Type\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"11976\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-data-type\/\"\n\t\t\t\tdata-post-title=\"MySQL JSON Data Type\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to use MySQL JSON data type to store JSON documents in the database.<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":11973,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-11976","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL JSON Data Type<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn how to use the MySQL JSON data type to store JSON documents in the database.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-data-type\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL JSON Data Type\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to use the MySQL JSON data type to store JSON documents in the database.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-data-type\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-06T06:56:35+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-json\\\/mysql-json-data-type\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-json\\\/mysql-json-data-type\\\/\",\"name\":\"MySQL JSON Data Type\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"datePublished\":\"2023-10-30T13:35:13+00:00\",\"dateModified\":\"2023-11-06T06:56:35+00:00\",\"description\":\"In this tutorial, you will learn how to use the MySQL JSON data type to store JSON documents in the database.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-json\\\/mysql-json-data-type\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-json\\\/mysql-json-data-type\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-json\\\/mysql-json-data-type\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL JSON\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-json\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"MySQL JSON Data Type\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL JSON Data Type","description":"In this tutorial, you will learn how to use the MySQL JSON data type to store JSON documents in the database.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-data-type\/","og_locale":"en_US","og_type":"article","og_title":"MySQL JSON Data Type","og_description":"In this tutorial, you will learn how to use the MySQL JSON data type to store JSON documents in the database.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-data-type\/","og_site_name":"MySQL Tutorial","article_modified_time":"2023-11-06T06:56:35+00:00","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-data-type\/","url":"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-data-type\/","name":"MySQL JSON Data Type","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"datePublished":"2023-10-30T13:35:13+00:00","dateModified":"2023-11-06T06:56:35+00:00","description":"In this tutorial, you will learn how to use the MySQL JSON data type to store JSON documents in the database.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-data-type\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-data-type\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-data-type\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL JSON","item":"https:\/\/www.mysqltutorial.org\/mysql-json\/"},{"@type":"ListItem","position":3,"name":"MySQL JSON Data Type"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/11976","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=11976"}],"version-history":[{"count":4,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/11976\/revisions"}],"predecessor-version":[{"id":12104,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/11976\/revisions\/12104"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/11973"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=11976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}