mysql json extract code example

Example 1: mysql json get value

SELECT JSON_EXTRACT('{"a": 1, "b": 2, "c": 3}', '$.b') AS 'Result';

Example 2: mysql json array contains

JSON_CONTAINS('[1,2,3,4,5]','7','$') Returns: 0
  JSON_CONTAINS('[1,2,3,4,5]','1','$') Returns: 1

Example 3: mysql JSON_SEARCH LIKE

$query=$query->whereRaw('UPPER(education->"$[*].profession") LIKE UPPER("%' . $profession . '%")');

Example 4: mysql json

SELECT json_clmn->'$.property' FROM table

Example 5: json_extract in non native query

Query query = em.createQuery("select o from Product o FUNCTION('JSON_EXTRACT', o.des, '$.org') = :org");