{"id":8514,"date":"2020-11-18T06:59:00","date_gmt":"2020-11-18T06:59:00","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=8514"},"modified":"2025-08-26T04:54:18","modified_gmt":"2025-08-26T04:54:18","slug":"how-to-store-json-data-in-mysql","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/","title":{"rendered":"How to Store JSON Data in MySQL"},"content":{"rendered":"\n<p>MySQL allows you to store JSON data in native JSON data type since version 5.7.8. This enables you to store JSON documents easily, and extract JSON data elements without data conversion. In this article, we will look at how to store JSON data in MySQL.<\/p>\n\n\n\n<p>MySQL JSON data type allows you to store JSON data such that you can easily read or search values in it using key or array index, making it really fast. There is no need to convert text to JSON or vice versa for querying data.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#Why_Store_JSON_Data_in_MySQL\" >Why Store JSON Data in MySQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#How_to_Store_JSON_Data_in_MySQL\" >How to Store JSON Data in MySQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#MySQL_JSON_Data_Type_Example\" >MySQL JSON Data Type Example<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#How_to_Insert_JSON_into_MySQL\" >How to Insert JSON into MySQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#Extract_JSON_Data_in_MySQL\" >Extract JSON Data in MySQL<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#Using_-%3E_Operator\" >Using -&gt; Operator<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#Using_-%3E%3E_operator\" >Using -&gt;&gt; operator<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#Using_operator\" >Using $. operator<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#Update_JSON_Data_in_MySQL\" >Update JSON Data in MySQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#Delete_JSON_Data\" >Delete JSON Data<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Why_Store_JSON_Data_in_MySQL\"><\/span>Why Store JSON Data in MySQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>These days most websites and apps exchange data between client and server in JSON format. This is because it allows you to store diverse and large amount of data in a compact manner. JSON data is commonly used to store information about user attributes, behaviors and events. But since JSON has a very flexible format, it can be tricky to store, retrieve and update this information in databases. Nevertheless, it has become imperative to store JSON data in MySQL. Earlier, developers had to write functions to convert JSON data into DBMS friendly format for storage and retrieval. Luckily, since MySQL 5.7.8, there are readymade functions available for this purpose.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Store_JSON_Data_in_MySQL\"><\/span>How to Store JSON Data in MySQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>We will look at how to store JSON data in MySQL and also how to query columns with JSON data type.<\/p>\n\n\n\n<p>Here&#8217;s the syntax to define a <a href=\"https:\/\/www.w3schools.com\/whatis\/whatis_json.asp\" target=\"_blank\" rel=\"noreferrer noopener\">JSON<\/a> column<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">column_name JSON<\/pre>\n\n\n\n<p>Please note, a JSON data type column cannot have default value, nor it can have an index.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"MySQL_JSON_Data_Type_Example\"><\/span>MySQL JSON Data Type Example<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>First, let us create a MySQL table with JSON column. Here&#8217;s an example of a table <em>users(id, details)<\/em> where <em>id<\/em> is an integer and primary key while <em>details<\/em> is a JSON data type column.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">create table users(\n    id int auto_increment primary key,\n    details <strong>json<\/strong>\n   );<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Insert_JSON_into_MySQL\"><\/span>How to Insert JSON into MySQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Here&#8217;s the SQL query to store JSON document in MySQL.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">insert into users(details)\n    values(\n      '{ \"page\": \"\/\" , \n         \"name\": \"Safari\", \n         \"os\": \"Mac\", \n         \"spend\": 100, \n         \"resolution\": { \"x\": 1920, \"y\": 1080 } }'\n),\n(\n      '{ \"page\": \"\/products\", \n         \"name\": \"Chrome\", \n         \"os\": \"Windows\", \n         \"spend\": 150,\n         \"resolution\": { \"x\": 1680, \"y\": 1050 } }'\n),\n(\n     '{ \"page\": \"\/shoes\", \n        \"name\": \"Firefox\", \n        \"os\": \"Windows\", \n        \"spend\": 200,\n        \"resolution\": { \"x\": 1280, \"y\": 800 } }'\n);<\/pre>\n\n\n\n<p>In the above SQL query, we have simply used JSON strings in values() clause. You can also store JSON strings as variables and then use them in SQL query as shown.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; set <strong>@sample<\/strong> = (<br>      '{ \"page\": \"\/\" , <br>         \"name\": \"Safari\", <br>         \"os\": \"Mac\", <br>         \"spend\": 100, <br>         \"resolution\": { \"x\": 1920, \"y\": 1080 } }'<br>);<br><br>mysql&gt; insert into users(details)<br>    values(<strong>@sample<\/strong>);<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Extract_JSON_Data_in_MySQL\"><\/span>Extract JSON Data in MySQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>There are 3 ways to extract data from JSON column, using -&gt; operator and -&gt;&gt; operator. Let us look at each of them one by one. In the following examples, $. stands for the JSON value of present row. You can use the dot operator to extract values of different keys.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Using_-%3E_Operator\"><\/span>Using -&gt; Operator<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>We will extract data from JSON columns using column path operator (-&gt;). Since MySQL 5.7.9, -&gt; operator is an alias for JSON_EXTRACT() function.<\/p>\n\n\n\n<p>Here&#8217;s an example to retrieve browser names for each user.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; select id, details-&gt;'$.name' details from users;<br>+----+-----------+<br>| id | details   |<br>+----+-----------+<br>|  1 | \"Safari\"  |<br>|  2 | \"Chrome\"  |<br>|  3 | \"Firefox\" |<br>+----+-----------+<\/pre>\n\n\n\n<p>Here is the same query using JSON_EXTRACT() function. JSON_EXTRACT() function takes 2 parameters &#8211; name of JSON column and named key.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; select id, json_extract(details, '$.name') details from users;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Using_-%3E%3E_operator\"><\/span>Using -&gt;&gt; operator<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>You will see that the details columns have double quotes. If you want to remove double quotes, use -&gt;&gt; operator instead<\/p>\n\n\n\n<pre id=\"block-6d6a741f-7cf7-4c68-9fe5-40c7f10596cf\" class=\"wp-block-preformatted\">mysql&gt; select id, details-&gt;&gt;'$.name' details from users;<br>+----+-----------+<br>| id | details   |<br>+----+-----------+<br>|  1 |  Safari   |<br>|  2 |  Chrome   |<br>|  3 |  Firefox  |<br>+----+-----------+<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Using_operator\"><\/span>Using $. operator<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>You can also aggregate JSON data GROUP BY clause and aggregation functions. Here&#8217;s an example to count number of browsers in our data.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; SELECT details-&gt;&gt;'$.name' detail,\ncount(detail)\nFROM users\nGROUP BY details-&gt;&gt;'$.name';<\/pre>\n\n\n\n<p>You will see the following output<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+---------+----------------+<br>| details | count(details) |<br>+---------+----------------+<br>| Safari  |              1 |<br>| Firefox |              1 |<br>| Chrome  |              1 |<br>+---------+----------------+<\/pre>\n\n\n\n<p>Similarly, you can also use JSON data in WHERE clause. Here&#8217;s an example to select data with <em>spend &gt; 100<\/em><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; SELECT id, SUM(details-&gt;&gt;'$.spend') spend\n       FROM users\n       WHERE details-&gt;&gt;'$.spend' &gt; 100\n       GROUP BY id;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Update_JSON_Data_in_MySQL\"><\/span>Update JSON Data in MySQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You can also update very specific values in a JSON column, not the entire JSON string, but a specific named key&#8217;s value, using JSON_INSERT() or JSON_REPLACE() functions. Both of them take 3 arguments &#8211; name of JSON column, named property and new value. Here is an example to update the name key&#8217;s value in row #1.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; UPDATE users<br>SET details = JSON_REPLACE(<br>        details ,<br>        '$.name' ,<br>        'Safari 2'<br>) WHERE id=1;<\/pre>\n\n\n\n<p>JSON_REPLACE() works only if a property to be updated already exists in the JSON column. If it does not exist, and you need to create it newly, then you need to use JSON_INSERT() function. Here is the query to add new property <em>style<\/em> to the JSON column of row #1.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; UPDATE users<br>SET details = JSON_INSERT(<br>        details ,<br>        '$.style' ,<br>        'new launch'<br>) WHERE id=1;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Delete_JSON_Data\"><\/span>Delete JSON Data<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You can also delete specific values in a JSON column using JSON_REMOVE() function and named keys as shown. JSON_REMOVE() takes 2 arguments &#8211; name of JSON column and its named key. Here is a query to remove <em>name<\/em> value of rows.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; UPDATE users SET details = JSON_REMOVE(details , '$.name')<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt several ways to work with JSON data. We have learnt how to insert JSON data, extract it, update and delete it. The best part is that MySQL provides out of the box functions to easily go deep into your JSON column value and work with it. Hopefully, this article will help you work with JSON data in MySQL. <\/p>\n\n\n\n<p><a href=\"https:\/\/ubiq.co\/\">Ubiq<\/a> makes it easy to visualize data, and monitor them in real-time dashboards. <a href=\"https:\/\/ubiq.co\/accounts\/register\">Try Ubiq<\/a> for free.<\/p>\n\n\n\n<p>Also read:<br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-compare-null-values-in-mysql\/\">How to Compare Null Values in MySQL<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-add-auto-increment-column-in-existing-table-in-mysql\/\">How to Add Auto Increment Column in MySQL Table<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/top-5-free-database-design-tools\/\">Top Free Database Design Tools<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL allows you to store JSON data, insert JSON string into MySQL, and extract JSON. Here is how to store JSON data in MySQL.<\/p>\n","protected":false},"author":1,"featured_media":8516,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[324],"tags":[479],"class_list":["post-8514","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql","tag-store-json"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Store JSON Data in MySQL - Ubiq BI<\/title>\n<meta name=\"description\" content=\"MySQL allows you to store JSON data, insert JSON string into MySQL, and extract JSON. Here is how to store JSON data in MySQL.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Store JSON Data in MySQL - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"MySQL allows you to store JSON data, insert JSON string into MySQL, and extract JSON. Here is how to store JSON data in MySQL.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-18T06:59:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-26T04:54:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/11\/how-to-store-json-mysql.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"730\" \/>\n\t<meta property=\"og:image:height\" content=\"410\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-store-json-data-in-mysql\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-store-json-data-in-mysql\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Store JSON Data in MySQL\",\"datePublished\":\"2020-11-18T06:59:00+00:00\",\"dateModified\":\"2025-08-26T04:54:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-store-json-data-in-mysql\\\/\"},\"wordCount\":808,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-store-json-data-in-mysql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/how-to-store-json-mysql.webp?fit=730%2C410&ssl=1\",\"keywords\":[\"store json\"],\"articleSection\":[\"MySQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-store-json-data-in-mysql\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-store-json-data-in-mysql\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-store-json-data-in-mysql\\\/\",\"name\":\"How to Store JSON Data in MySQL - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-store-json-data-in-mysql\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-store-json-data-in-mysql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/how-to-store-json-mysql.webp?fit=730%2C410&ssl=1\",\"datePublished\":\"2020-11-18T06:59:00+00:00\",\"dateModified\":\"2025-08-26T04:54:18+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"MySQL allows you to store JSON data, insert JSON string into MySQL, and extract JSON. Here is how to store JSON data in MySQL.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-store-json-data-in-mysql\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-store-json-data-in-mysql\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-store-json-data-in-mysql\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/how-to-store-json-mysql.webp?fit=730%2C410&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/how-to-store-json-mysql.webp?fit=730%2C410&ssl=1\",\"width\":730,\"height\":410,\"caption\":\"store json in mysql\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-store-json-data-in-mysql\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Store JSON Data in MySQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Store JSON Data in MySQL - Ubiq BI","description":"MySQL allows you to store JSON data, insert JSON string into MySQL, and extract JSON. Here is how to store JSON data in MySQL.","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:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/","og_locale":"en_US","og_type":"article","og_title":"How to Store JSON Data in MySQL - Ubiq BI","og_description":"MySQL allows you to store JSON data, insert JSON string into MySQL, and extract JSON. Here is how to store JSON data in MySQL.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2020-11-18T06:59:00+00:00","article_modified_time":"2025-08-26T04:54:18+00:00","og_image":[{"width":730,"height":410,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/11\/how-to-store-json-mysql.webp","type":"image\/webp"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Store JSON Data in MySQL","datePublished":"2020-11-18T06:59:00+00:00","dateModified":"2025-08-26T04:54:18+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/"},"wordCount":808,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/11\/how-to-store-json-mysql.webp?fit=730%2C410&ssl=1","keywords":["store json"],"articleSection":["MySQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/","name":"How to Store JSON Data in MySQL - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/11\/how-to-store-json-mysql.webp?fit=730%2C410&ssl=1","datePublished":"2020-11-18T06:59:00+00:00","dateModified":"2025-08-26T04:54:18+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"MySQL allows you to store JSON data, insert JSON string into MySQL, and extract JSON. Here is how to store JSON data in MySQL.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/11\/how-to-store-json-mysql.webp?fit=730%2C410&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/11\/how-to-store-json-mysql.webp?fit=730%2C410&ssl=1","width":730,"height":410,"caption":"store json in mysql"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-store-json-data-in-mysql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Store JSON Data in MySQL"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/11\/how-to-store-json-mysql.webp?fit=730%2C410&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-2dk","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/8514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=8514"}],"version-history":[{"count":2,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/8514\/revisions"}],"predecessor-version":[{"id":9298,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/8514\/revisions\/9298"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/8516"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=8514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=8514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=8514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}