John Derring John Derring - 4 months ago 105
MySQL Question

How to select from JSON field in MySQL 5.6 where json_extract is not available?

If my row has a

with the following value: "
", how could I select the whole row if I need the value to contain one of the numbers (a 2 or a 3)?


As you said, you're using MySQL 5.6, so the JSON_EXTRACT() function is not available.

The only options I would recommend are:

  1. Upgrade to MySQL 5.7

  2. Fetch the whole JSON document into an application and use a JSON decoding function.

You could also try to parse JSON using other string functions available in MySQL 5.6, but it'll be awkward and time-consuming to develop.