John Derring John Derring - 1 year ago 456
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)?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download