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