以香港VPS为例,mysql中存储json格式数据的方法
具体方法如下:
#新建表
create table json_user (
uid int auto_increment,
data json,
primary key(uid)
);
#插入数据
insert into json_user values (
null, ‘{
“name”:”lison”,
“age”:18,
“address”:”enjoy”
}’ );
insert into json_user values (
null,
‘{
“name”:”james”,
“age”:28,
“mail”:”james@163.com”
}’);