Outdated Version

You are viewing an older version of this section. View current production version.


This is a set of three JSON functions, which returns the value of a given key in a JSON map. Maps are in the form:

{"a": 1, "b": 2, "c": 3}
  • JSON_EXTRACT_DOUBLE is for all numeric data. Javascript has only one numeric type.
  • JSON_EXTRACT_STRING is for all text and binary types.
  • JSON_EXTRACT_JSON is for all valid Javascript types, including true, false, JSON maps, and lists.
JSON_EXTRACT_<type>(json, keyname)


  • json: a valid JSON map, or the name of a JSON column.
  • keyname: the named key to extract.

Return Type

  • The extracted element.
  • SQL NULL if json is not a valid JSON array, or if keyname does not exist.


mysql> select json_extract_double('{"a":1, "b":2, "c": [3,4,5]}', 'b') as get_b;
| get_b |
|     2 |

mysql> select json_extract_json('{"a":1, "b":2, "c": [3,4,5]}', 'c') as get_c;
| get_c   |
| [3,4,5] |

mysql> select json_extract_json('{"a":1, "b":2, "c": [3,4,5]}', 'z') as get_z;
| get_z |
| NULL  |