To be able to do what you want to, you need MySQL 5.7.8+. Since 5.7.8 you can use JSON_EXTRACT function to extract a value from a JSON string:
SELECT JSON_EXTRACT('{"id": 14, "name": "Aztalan"}', '$.name');
+---------------------------------------------------------+
| JSON_EXTRACT('{"id": 14, "name": "Aztalan"}', '$.name') |
+---------------------------------------------------------+
| "Aztalan" |
+---------------------------------------------------------+
Taken from here.
In MySQL 5.6 you just can’t get the value you want as MySQL doesn’t know anything about what a JSON object is. So your options are:
- Upgrade to 5.7.8+
- Parse the query result with something that handles JSON:
- Could be PHP json_decode (or equivalent in your language)
- An online tool like http://json.parser.online.fr/