Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

mysql 存储一个json字段,但是这个json对象非常复杂。我不知道如何处理

mysql 存储一个json字段,

drop table if exists `xxhtml`;
CREATE TABLE if not exists `gg`.`xxhtml` (
    id BIGINT UNSIGNED auto_increment not null comment '编号',
    html json not null comment '转化为json的,html内容',
    createTime timestamp  comment '创建时间',
    updateTime timestamp  comment '更新时间',
    removeTime timestamp  comment '删除时间',
    primary key (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ;

该json是html转化而来的。我用Mybatis读取,使用jackson处理。

平时处理json的java对象都非常简单,但是html转化为json的,这个json就比较复杂了。

我不知道如何处理,比如如何用pojo类标识


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

这种层次太深了,而且不固定,你使用json真的不推荐,还不如是使用xml处理


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...