Generated column based on JSON field

Hi,

I would like to create a new generated column whose value is based on data inside a JSON column. The examples provided do not show how to do this. Could you please provide guidance ? Thanks !

NR

Hello @Nicolas_REMY

Could you give a simple example?

Regards

Sure !

Column jsonData includes data in the form of {"key": "value"}
I need to create a generated column which outputs value. So I tried to set the Expression to jsonData.key . But I get an error saying : Unknown column 'key' in 'generated column function'

@Nicolas_REMY

What behavior do you expect for {"key1": "value1", "key2": "value2"}?

@Nicolas_REMY

Some simple example


Here are more functions to work with JSON type
https://dev.mysql.com/doc/refman/5.7/en/json-function-reference.html

Regards

Great ! Didn’t realize that MySQL functions worked. That should answer the question, thanks.