0

I have a json column with the following array:

[  
   {
     "name":"Raj",
     "email":"raj@gmail.com",
     "age":32
      
   },
   {
     "name":"Mohan",
     "email":"Mohan@yahoo.com",
     "age":21
      
   }   
]

I want to get an object whose name is Raj. Output :

[  
 {
 "name":"Raj",
 "email":"raj@gmail.com",
 "age":32
 } 
]

Can you help me for MYSQL query for this?

5a01d01P
  • 663
  • 2
  • 9
  • 20
  • 1
    JSON data type has specific documentation page about how to use it (update, query…). https://dev.mysql.com/doc/refman/8.0/en/json.html – Baptiste Donaux Jul 16 '20 at 08:02
  • @BaptisteDonaux Yes, I know there is documentation. But not able to get this result. – 5a01d01P Jul 16 '20 at 12:10
  • I'm not sure that you can do this with MySQL 8.0. But you can extract value of a JSON value. https://dev.mysql.com/doc/refman/5.7/en/json-search-functions.html#function_json-extract With this, you can determine JSON which contains a specific value. – Baptiste Donaux Jul 16 '20 at 13:22

0 Answers0