Your key = 'article_body' is an array JSON, so you need to use index get the data.

You can try this.

Schema (MySQL v5.7)

CREATE TABLE wc_article_full_data(

   full_article_json JSON
);

insert into wc_article_full_data values (
'{"article_body" : [
    {
        "article_desc" : "THURSDAY, Sept. 1, 2016 (HealthDay News) -- Dapagliflozin improves insulin sensitivity and increases lipid oxidation and plasma ketone concentration in patients with type 2 diabetes mellitus (T2DM), according to a study published online Aug. 25 in Diabetes Care.  Giuseppe Daniele",
        "links" : [{
                "link_name" : "Full Text (subscription or payment may be required)"}
        ]}
]}');

Query #1

SELECT JSON_EXTRACT(full_article_json,'$.article_body[0].article_desc') AS descriptio
FROM wc_article_full_data;

| descriptio                                                                                                                                                                                                                                                                                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| "THURSDAY, Sept. 1, 2016 (HealthDay News) -- Dapagliflozin improves insulin sensitivity and increases lipid oxidation and plasma ketone concentration in patients with type 2 diabetes mellitus (T2DM), according to a study published online Aug. 25 in Diabetes Care.  Giuseppe Daniele" |

View on DB Fiddle

If you want to get all value from article_desc which from article_body array. you can try to use* in index.

SELECT JSON_EXTRACT(full_article_json,'$.article_body[*].article_desc') AS descriptio
FROM wc_article_full_data
Answer from D-Shih on Stack Overflow
Top answer
1 of 2
9

Your key = 'article_body' is an array JSON, so you need to use index get the data.

You can try this.

Schema (MySQL v5.7)

CREATE TABLE wc_article_full_data(

   full_article_json JSON
);

insert into wc_article_full_data values (
'{"article_body" : [
    {
        "article_desc" : "THURSDAY, Sept. 1, 2016 (HealthDay News) -- Dapagliflozin improves insulin sensitivity and increases lipid oxidation and plasma ketone concentration in patients with type 2 diabetes mellitus (T2DM), according to a study published online Aug. 25 in Diabetes Care.  Giuseppe Daniele",
        "links" : [{
                "link_name" : "Full Text (subscription or payment may be required)"}
        ]}
]}');

Query #1

SELECT JSON_EXTRACT(full_article_json,'$.article_body[0].article_desc') AS descriptio
FROM wc_article_full_data;

| descriptio                                                                                                                                                                                                                                                                                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| "THURSDAY, Sept. 1, 2016 (HealthDay News) -- Dapagliflozin improves insulin sensitivity and increases lipid oxidation and plasma ketone concentration in patients with type 2 diabetes mellitus (T2DM), according to a study published online Aug. 25 in Diabetes Care.  Giuseppe Daniele" |

View on DB Fiddle

If you want to get all value from article_desc which from article_body array. you can try to use* in index.

SELECT JSON_EXTRACT(full_article_json,'$.article_body[*].article_desc') AS descriptio
FROM wc_article_full_data
2 of 2
4

use JSON_KEYS

eg.

SELECT JSON_KEYS(full_article_json) as jsonKeys;

it will return all the keys from the json array

🌐
DataCamp
datacamp.com › doc › mysql › mysql-json-extract
MySQL JSON_EXTRACT() Function: Usage & Examples
SELECT JSON_EXTRACT('[10, 20, 30, {"key": "value"}]', '$[3].key'); The function extracts the value `"value"` from a JSON array element at index 3, which is a JSON object with a `key`.
🌐
MySQL
dev.mysql.com › doc › refman › 8.4 › en › json-search-functions.html
MySQL :: MySQL 8.4 Reference Manual :: 14.17.3 Functions That Search JSON Values
This function serves as counterpart to JSON_CONTAINS(), which requires all elements of the array searched for to be present in the array searched in. Thus, JSON_CONTAINS() performs an AND operation on search keys, while JSON_OVERLAPS() performs an OR operation. Queries on JSON columns of InnoDB tables using JSON_OVERLAPS() in the WHERE clause can be optimized using multi-valued indexes.
🌐
Quora
quora.com › How-do-you-get-a-specific-keys-value-from-a-JSON-field-with-MySQL
How to get a specific key's value from a JSON field with MySQL - Quora
Answer (1 of 2): MySQL 5.7.8 included the new JavaScript Object Notation (JSON) data type that enabled more efficient access to JSON-encoded data. Native support provided a few perks such as automatic validation of JSON documents stored in JSON columns as well as storage optimization. Querying J...
🌐
Ubiq BI
ubiq.co › home › how to query json column in mysql
How to Query JSON column in MySQL - Ubiq BI
September 1, 2025 - MySQL >= 5.7 features json_extract() function. Here is its syntax. select json_extract(json, '$.key') from table where json_extract(json, '$.key') = 'value' Here is a query to get row where browser name is Chrome.
🌐
Database Guide
database.guide › json_keys-return-the-keys-from-a-json-object-in-mysql
JSON_KEYS() – Return the Keys from a JSON Object in MySQL
July 27, 2018 - Therefore, you’ll get a NULL value if you try to return keys from an array. ... However, if any of the array’s elements contains an object, you can still use the path argument to get the keys from that object. SELECT JSON_KEYS('[1, 2, {"a": 1, "b": 2}]', '$[2]') AS 'Result';
🌐
Database Guide
database.guide › json_extract-return-data-from-a-json-document-in-mysql
JSON_EXTRACT() – Return Data from a JSON Document in MySQL
In this case, we returned the value of the key b. ... If you specify a path that doesn’t exist a NULL value is returned. SELECT JSON_EXTRACT('{"Name": "Homer", "Age": 39}', '$.Gender') AS 'Result'; ... You’ll also get a NULL value if any of the arguments are NULL.
Find elsewhere
🌐
MySQL
dev.mysql.com › doc › refman › 8.0 › en › json-search-functions.html
MySQL :: MySQL 8.0 Reference Manual :: 14.17.3 Functions That Search JSON Values
March 10, 2022 - This function serves as counterpart to JSON_CONTAINS(), which requires all elements of the array searched for to be present in the array searched in. Thus, JSON_CONTAINS() performs an AND operation on search keys, while JSON_OVERLAPS() performs an OR operation. Queries on JSON columns of InnoDB tables using JSON_OVERLAPS() in the WHERE clause can be optimized using multi-valued indexes.
🌐
Oracle
docs.oracle.com › cd › E17952_01 › mysql-5.7-en › json-search-functions.html
12.17.3 Functions That Search JSON Values
February 9, 2026 - An error occurs if the json_doc argument is not a valid JSON document or the path argument is not a valid path expression or contains a * or ** wildcard. The result array is empty if the selected object is empty. If the top-level value has nested subobjects, the return value does not include keys from those subobjects. mysql> SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}'); +---------------------------------------+ | JSON_KEYS('{"a": 1, "b": {"c": 30}}') | +---------------------------------------+ | ["a", "b"] | +---------------------------------------+ mysql> SELECT JSON_KEYS('{"a": 1, "b": {"c": 30}}', '$.b'); +----------------------------------------------+ | JSON_KEYS('{"a": 1, "b": {"c": 30}}', '$.b') | +----------------------------------------------+ | ["c"] | +----------------------------------------------+
🌐
Medium
medium.com › geekculture › how-to-query-json-objects-in-mysql-dab878c37aeb
How to query Json objects in MySQL? | by Srihari Pramod | Geek Culture | Medium
December 6, 2022 - However, there are some workarounds that you can use to query JSON data in MySQL. One option is to use the JSON_EXTRACT() function to extract a scalar value from a JSON column. For example: SELECT JSON_EXTRACT(json_column, ‘$.key’) FROM ...
🌐
Data and Open Source
ftisiot.net › mysqljson › how-to-extract-field-from-json-mysql
How to extract a field from a JSON object in MySQL | Data and Open Source
July 21, 2023 - To extract a field value from a JSON document, you can use the -> operator. The id and name fields can be extracted with: select json_data -> '$.id' id, json_data -> '$.name' name from test;
🌐
MySQL Tutorial
mysqltutorial.org › home › mysql json › mysql json_keys() function
MySQL JSON_KEYS() Function
October 31, 2023 - In this tutorial, you will learn how to use the MySQL JSON_KEYS() function to retrieve the property names of a JSON object.
🌐
Database Guide
database.guide › 6-ways-to-extract-json-data-in-mysql
6 Ways to Extract JSON Data in MySQL
Below are six methods we can use to do this. As its name suggests, the JSON_EXTRACT() function extracts data from a JSON document. When we do this, we need to pass the JSON document, along with one or more paths for which to extract data from. ... We can see that the value ...
🌐
Towards Data Science
towardsdatascience.com › home › latest › how to work with json data in mysql
How to work with JSON data in MySQL | Towards Data Science
March 5, 2025 - Key takeaway for extracting data from a JSON field in MySQL: Use $.key to extract the value of a key from a JSON object.
🌐
PopSQL
popsql.com › learn-sql › mysql › how-to-query-a-json-column-in-mysql
How to Query a JSON Column in MySQL - PopSQL
Here's how you can query a JSON column in MySQL: -- Getting the params.name string value from events table SELECT params->>'$.name' FROM events; -- Getting rows where the browser.name is Chrome -- This also shows the difference of using -> vs ->> -- Using -> will cause strings to be enclosed in quotes SELECT browser->>'$.name', browser->'$.name' FROM events WHERE browser->>'$.name' = 'Chrome'; -- Give me the first index of a JSON array SELECT properties->>'$.my_array[0]' FROM events; -- Going deeper to get the X resolution only SELECT properties->'$.resolution.x' FROM events;
🌐
MySQL
dev.mysql.com › doc › refman › 9.1 › en › json.html
MySQL :: MySQL 9.1 Reference Manual :: 13.5 The JSON Data Type
When the server later must read a JSON value stored in this binary format, the value need not be parsed from a text representation. The binary format is structured to enable the server to look up subobjects or nested values directly by key or array index without reading all values before or ...
Top answer
1 of 3
7

There is a way to solve this in SQL 5.7. I will go step by step in composing the solution. The goal is to find the strength of the knight.

I am going to use the same sample table as previous post:

create table mytable ( mycol json );

insert into mytable set mycol = '[{"Race": "Orc", "strength": 14}, {"Race": "Knight", "strength": 7}]';

First, get an array of only the races.

select json_extract(mycol, '$[*].Race') from mytable;
+----------------------------------+
| json_extract(mycol, '$[*].Race') |
+----------------------------------+
| ["Orc", "Knight"]                |
+----------------------------------+

Then, search for the Knight in this array (and unquote it).

select json_unquote(json_search(json_extract(mycol, '$[*].Race'), 'one', 'Knight')) from mytable;
+------------------------------------------------------------------------------+
| json_unquote(json_search(json_extract(mycol, '$[*].Race'), 'one', 'Knight')) |
+------------------------------------------------------------------------------+
| $[1]                                                                         |
+------------------------------------------------------------------------------+

Having found the index, get this element from the array.

select json_extract(mycol, json_unquote(json_search(json_extract(mycol, '$[*].Race'), 'one', 'Knight'))) from mytable;
+---------------------------------------------------------------------------------------------------+
| json_extract(mycol, json_unquote(json_search(json_extract(mycol, '$[*].Race'), 'one', 'Knight'))) |
+---------------------------------------------------------------------------------------------------+
| {"Race": "Knight", "strength": 7}                                                                 |
+---------------------------------------------------------------------------------------------------+

Then get the strength of this element.

select json_extract(json_extract(mycol, json_unquote(json_search(json_extract(mycol, '$[*].Race'), 'one', 'Knight'))), '$.strength') as strength from mytable;
+----------+
| strength |
+----------+
| 7        |
+----------+

You can repeat this on other fields to create other columns.

2 of 3
6

You're essentially meaning to apply selection and projection to the array elements and object fields of your JSON document. You need to do something like a WHERE clause to select a "row" within the array, and then do something like picking one of the fields (not the one you used in your selection criteria).

These are done in SQL using the WHERE clause and the SELECT-list of columns, but doing the same with JSON isn't something you can do easily with functions like JSON_SEARCH() and JSON_CONTAINS().

The solution MySQL 8.0 provides is the JSON_TABLE() function to turn a JSON document into a virtual derived table — as though you had defined conventional rows and columns. It works if the JSON is in the format you describe, an array of objects.

Here's a demo I did by inserting your example data into a table:

create table mytable ( mycol json );

insert into mytable set mycol = '[{"Race": "Orc", "strength": 14}, {"Race": "Knight", "strength": 7}]';

SELECT j.* FROM mytable, JSON_TABLE(mycol, 
  '$[*]' COLUMNS (
    race VARCHAR(10) PATH '$.Race', 
    strength INT PATH '$.strength'
  )
) AS j;
+--------+----------+
| race   | strength |
+--------+----------+
| Orc    |       14 |
| Knight |        7 |
+--------+----------+

Now you can do things you normally do with SELECT queries, like selection and projection:

SELECT j.strength FROM mytable, JSON_TABLE(mycol, '$[*]' 
  COLUMNS (
    race VARCHAR(10) PATH '$.Race', 
    strength INT PATH '$.strength'
  )
) AS j 
WHERE j.race = 'Orc'
+----------+
| strength |
+----------+
|       14 |
+----------+

This has a couple of problems:

  1. You need to do this every time you query the JSON data, or else create a VIEW to do it.

  2. You said you don't know the attribute fields, but to write a JSON_TABLE() query, you must specify the attributes you want to search and project in your query. You can't use this for totally undefined data.

I've answered quite a number of similar questions about using JSON in MySQL. I've observed that when you want to do this sort of thing, treating a JSON document like a table so you can apply condition in the WHERE clause to fields within your JSON data, then all your queries get a lot more difficult. Then you start feeling like you would have been better off spending a few minutes to define your attributes so you could write simpler queries.

🌐
Vultr
docs.vultr.com › how-to-work-with-json-data-in-mysql
How to Work with JSON Data in MySQL - Complete Guide
April 1, 2025 - In the next step, you'll parse JSON documents from a MySQL table. You can deserialize a JSON document and retrieve the value of any named key using the MySQL JSON_EXTRACT function.