A JSONArray text must start with at 1

A JSONArray text must start with at 1 [character 2 line 1]

起因:String数组转 JSON 后端调用出错

复制代码
JSONUtil.toList(xx.getTags(), String.class) 

数据库对象entity转包装类 方法 ,其中数据库字段tags是String类型,在包装类中想转换为 JSON

java 复制代码
public static PostVO objToVo(Post post) {
        if (post == null) {
            return null;
        }
        PostVO postVO = new PostVO();
        BeanUtils.copyProperties(post, postVO);
        postVO.setTagList(JSONUtil.toList(post.getTags(), String.class));
        return postVO;
    }

原因:数据库存入的字段不对,不应该是 xx ,而是应该是 [XX,XX]

相关推荐
是小崔啊3 小时前
事务03之MVCC机制
数据库·mysql·事务·
LUCIAZZZ7 小时前
简单的SQL语句的快速复习
java·数据库·sql
Elastic 中国社区官方博客9 小时前
使用真实 Elasticsearch 进行高级集成测试
大数据·数据库·elasticsearch·搜索引擎·全文检索·jenkins·集成测试
@_@哆啦A梦9 小时前
Redis 基础命令
java·数据库·redis
fajianchen9 小时前
MySQL 索引存储结构
数据库·mysql
想做富婆9 小时前
oracle: 多表查询之联合查询[交集intersect, 并集union,差集minus]
数据库·oracle·联合查询
xianwu54311 小时前
反向代理模块jmh
开发语言·网络·数据库·c++·mysql
Leven19952711 小时前
Flink (十三) :Table API 与 DataStream API 的转换 (一)
数据库·sql·flink
geovindu11 小时前
neo4j-community-5.26.0 create new database
数据库·mysql·neo4j
因特麦克斯12 小时前
索引的底层数据结构、B+树的结构、为什么InnoDB使用B+树而不是B树呢
数据库