Java 在消息中发送类字段元数据
有人在Java 在消息中发送类字段元数据,java,json,reflection,jackson,meta,Java,Json,Reflection,Jackson,Meta,有人在jackson-JSON中遇到过这个问题吗?不知怎么的,JSON包含了我的每个类的字段类型,以及我不感兴趣的其他元数据,因此发送的数据是巨大的 例如,这是一个记录: { "queue": "H", "internalStatus": "New", "id": "50030386", "screenDescription": "Test Case 1", } }, "fields": [ { "name": "id", "type": "ja
jackson-JSON
中遇到过这个问题吗?不知怎么的,JSON
包含了我的每个类的字段类型,以及我不感兴趣的其他元数据,因此发送的数据是巨大的
例如,这是一个记录:
{
"queue": "H",
"internalStatus": "New",
"id": "50030386",
"screenDescription": "Test Case 1",
}
},
"fields": [
{
"name": "id",
"type": "java.lang.Integer",
"modifiers": 2,
"annotations": [
],
"declaredAnnotations": [
],
"declaringClass": "com.me.Charge",
"synthetic": false,
"genericType": "java.lang.Integer",
"enumConstant": false,
"accessible": false
},
{
"name": "screenDescription",
"type": "java.lang.String",
"modifiers": 2,
"annotations": [
],
"declaredAnnotations": [
],
"declaringClass": "com.me.Charge",
"synthetic": false,
"genericType": "java.lang.String",
"enumConstant": false,
"accessible": false
},
{
"name": "internalStatus",
"type": "java.lang.String",
"modifiers": 2,
"annotations": [
],
"declaredAnnotations": [
],
"declaringClass": "com.me.Charge",
"synthetic": false,
"genericType": "java.lang.String",
"enumConstant": false,
"accessible": false
},
{
"name": "queue",
"type": "java.lang.String",
"modifiers": 2,
"annotations": [
],
"declaredAnnotations": [
],
"declaringClass": "com.me.Charge",
"synthetic": false,
"genericType": "java.lang.String",
"enumConstant": false,
"accessible": false
},
感谢您的帮助
谢谢,
Stephen检查您的代码以进行设置
objectMapper.enableDefaultTyping(...)
从某种意义上说…我们可以看到您试图序列化的类吗?这是多态类型的正常行为。如果你能包括你使用的杰克逊版本,我们可以告诉你如何摆脱它