• FastJSON错误Could not read JSON: Unrecognized field


    系列文章目录



    前言

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到网站,这篇文章男女通用,看懂了就去分享给你的码吧。
    在这里插入图片描述
    fastjson 是一个性能很好的 Java 语言实现的 JSON 解析器和生成器,来自阿里巴巴的工程师开发。


    一、主要特点

    快速FAST (比其它任何基于Java的解析器和生成器更快,包括jackson)

    强大(支持普通JDK类包括任意Java Bean Class、Collection、Map、Date或enum)

    零依赖(没有依赖其它任何类库除了JDK)
    在使用FastJSON时,报错Could not read JSON: Unrecognized field,详细错误如下

    org.springframework.data.redis.serializer.SerializationException: Could not read JSON: Unrecognized field "normol" (class com.example.springboot.model.Blog), not marked as ignorable (5 known properties: "isDel", "id", "birthday", "name", "del"])
     at [Source: (byte[])"["com.example.springboot.model.Blog",{"id":1,"name":"Java小强","isDel":false,"birthday":["java.util.Date","2024-01-15 13:45:38"],"del":false,"normol":true}]"; line: 1, column: 157] (through reference chain: com.example.springboot.model.Blog["normol"]); nested exception is com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "normol" (class com.example.springboot.model.Blog), not marked as ignorable (5 known properties: "isDel", "id", "birthday", "name", "del"])
     at [Source: (byte[])"["com.example.springboot.model.Blog",{"id":1,"name":"Java小强","isDel":false,"birthday":["java.util.Date","2024-01-15 13:45:38"],"del":false,"normol":true}]"; line: 1, column: 157] (through reference chain: com.example.springboot.model.Blog["normol"])
     
        at org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer.deserialize(Jackson2JsonRedisSerializer.java:75)
        at org.springframework.data.redis.core.AbstractOperations.deserializeValue(AbstractOperations.java:360)
        at org.springframework.data.redis.core.AbstractOperations$ValueDeserializingRedisCallback.doInRedis(AbstractOperations.java:62)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:224)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:191)
        at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:97)
        at org.springframework.data.redis.core.DefaultValueOperations.get(DefaultValueOperations.java:54)
        at com.example.springboot.redis.RedisTest.objTest(RedisTest.java:366)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
        at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
        at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
        at org.junit
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
  • 相关阅读:
    c++征途 ---- 类与对象 --- 继承
    Ubuntu Flask 运行 gunicorn+Nginx 部署
    【Go语言学习笔记】函数
    如何在Vue中实现事件处理?
    济南 章丘 科目三 资料 收集
    【SpringMVC】加载控制、Postmand的使用、Rest风格的引入以及体验RestFul极速开发
    无哨兵位单向非循环链表
    Java进阶常用的辅助类(CountDownLatch 减法计数器、CyclicBarrier 加法计数器、Semaphore 信号量)
    打印流详解
    中国象棋棋盘识别
  • 原文地址:https://blog.csdn.net/pleaseprintf/article/details/136766275